/*
Theme Name: Ellerslie Medical
Theme URI: https://www.ellersliemedical.co.nz/
Author: Ellerslie Medical Centre
Description: A warm, plain-spoken block theme for Ellerslie Medical Centre, a GP-owned family practice in Ellerslie, Auckland. Built for the Site Editor, with no page-builder dependencies and no third-party font tracking.
Requires at least: 6.6
Tested up to: 6.9
Requires PHP: 7.4
Version: 1.2.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ellerslie-medical
Tags: block-theme, full-site-editing, accessibility-ready, custom-colors, editor-style, wide-blocks, style-variations
*/

/* ------------------------------------------------------------------
   Tokens (derived from the palette, so style variations follow along)
------------------------------------------------------------------- */
:root {
	--em-blue: var(--wp--preset--color--navy);
	--em-blue-deep: var(--wp--preset--color--navy-deep, var(--wp--preset--color--navy));
	--em-orange: var(--wp--preset--color--orange);
	--em-line: var(--wp--preset--color--stone);
	--em-on-dark-accent: #FFD9B8;
	--em-on-dark-muted: rgba(255, 255, 255, 0.78);
	--em-radius: var(--wp--custom--radius--organic, 20px);
	--em-radius-sm: var(--wp--custom--radius--small, 10px);
	/* Seamless waves: each tile starts and ends at the same height and slope, so the joins are invisible. */
	--em-wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 18' preserveAspectRatio='none'%3E%3Cpath d='M0 9 C 15 3, 45 3, 60 9 S 105 15, 120 9 L120 18 L0 18 Z'/%3E%3C/svg%3E");
	--em-wave-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 18' preserveAspectRatio='none'%3E%3Cpath d='M0 9 C 15 15, 45 15, 60 9 S 105 3, 120 9 L120 18 L0 18 Z'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------
   Base
------------------------------------------------------------------- */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { text-rendering: optimizeLegibility; overflow-wrap: break-word; -webkit-font-smoothing: antialiased; }
::selection { background: var(--wp--preset--color--peach); color: var(--wp--preset--color--ink); }

a { text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--em-orange);
	outline-offset: 3px;
	border-radius: 4px;
}

img { height: auto; max-width: 100%; }

h1, h2, h3, .wp-block-post-title { text-wrap: balance; }
p { text-wrap: pretty; }

.skip-link.screen-reader-text:focus {
	background: var(--em-blue);
	color: #fff;
	padding: 0.75rem 1rem;
	z-index: 100000;
}

/* Buttons: a little lift on hover */
.wp-element-button, .wp-block-button__link {
	transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.wp-block-button:not(.is-style-outline) .wp-block-button__link:hover {
	box-shadow: 0 6px 16px color-mix(in srgb, var(--em-orange) 28%, transparent);
	transform: translateY(-1px);
}
.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--em-blue);
	border: 2px solid currentColor;
	padding-top: calc(0.75em - 2px);
	padding-bottom: calc(0.75em - 2px);
}
.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--em-blue);
	border-color: var(--em-blue);
	color: #fff;
}

/* ------------------------------------------------------------------
   Top bar and header
------------------------------------------------------------------- */
.em-topbar { font-size: var(--wp--preset--font-size--small); }
.em-topbar.has-navy-background-color { background-color: var(--em-blue-deep) !important; }
.em-topbar a { color: inherit; text-decoration: none; }
.em-topbar a:hover { text-decoration: underline; }
.em-topbar p { margin: 0; }
.em-topbar .em-topbar__urgent a {
	font-weight: 700;
	color: var(--em-on-dark-accent);
}
@media (max-width: 600px) {
	.em-topbar .em-icon-pin, .em-topbar .em-icon-clock, .em-topbar .em-icon-portal { display: none; }
	.em-topbar > .wp-block-group { flex-wrap: nowrap !important; }
	.em-topbar .em-icon-phone a { font-weight: 600; }
}

p[class*="em-icon-"]::before {
	content: "";
	display: inline-block;
	width: 1em;
	height: 1em;
	margin-right: 0.4em;
	vertical-align: -0.15em;
	background: currentColor;
	-webkit-mask: var(--em-ico) center / contain no-repeat;
	mask: var(--em-ico) center / contain no-repeat;
}

.em-header {
	border-bottom: 1px solid var(--em-line);
	box-shadow: 0 2px 14px rgba(28, 39, 51, 0.04);
	position: relative;
	z-index: 20;
}
.em-header .wp-block-image.em-logo { margin: 0; }
.em-header .wp-block-image.em-logo img { border-radius: 0; width: 210px; }

/* Desktop menu links: quiet ink text, brand-blue and an orange bar on hover */
.em-header .wp-block-navigation .wp-block-navigation-item__content { position: relative; }
@media (min-width: 1181px) {
	.em-header .wp-block-navigation > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: -0.35rem;
		height: 3px;
		border-radius: 3px;
		background: var(--em-orange);
		transform: scaleX(0);
		transform-origin: left;
		transition: transform 0.2s ease;
	}
	.em-header .wp-block-navigation > .wp-block-navigation__container > .wp-block-navigation-item:hover > .wp-block-navigation-item__content::after,
	.em-header .wp-block-navigation > .wp-block-navigation__container > .current-menu-item > .wp-block-navigation-item__content::after,
	.em-header .wp-block-navigation > .wp-block-navigation__container > .current-menu-ancestor > .wp-block-navigation-item__content::after {
		transform: scaleX(1);
	}
	.em-header .wp-block-navigation-submenu > .wp-block-navigation-item__content::after { right: 1.1em !important; }
}

/* Dropdowns */
.em-header .wp-block-navigation .wp-block-navigation__submenu-container {
	background: var(--wp--preset--color--white);
	border: 1px solid var(--em-line) !important;
	border-radius: 14px;
	box-shadow: var(--wp--preset--shadow--lift);
	padding: 0.5rem !important;
	min-width: 16rem;
}
.em-header .wp-block-navigation:not(.is-menu-open) .wp-block-navigation__submenu-container { margin-top: 0.6rem; }
.em-header .wp-block-navigation:not(.is-menu-open) .wp-block-navigation__submenu-container::before {
	/* hover bridge so the menu doesn't close when the pointer crosses the gap */
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -0.8rem;
	height: 0.8rem;
}
.em-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0.55rem 0.85rem;
	border-radius: 8px;
}
.em-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
	background: var(--wp--preset--color--paper-deep);
	color: var(--em-blue);
}
.em-header .wp-block-navigation-item.current-menu-item > .wp-block-navigation-item__content { color: var(--em-blue); }

/* Extras that only belong in the phone menu (Book / Call buttons) */
.em-header .wp-block-navigation-item:has(> .em-nav-extras),
.em-header .em-nav-extras { display: none; }

/* Seven menu items need room: use the menu button below ~1180px, not just on phones. */
@media (min-width: 600px) and (max-width: 1180px) {
	.em-header .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex !important; }
	.em-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none !important; }
}

/* The menu button: icon plus the word "Menu" so everyone knows what it is */
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close { color: var(--em-blue); }
.em-header .wp-block-navigation__responsive-container-open {
	align-items: center;
	gap: 0.35rem;
	padding: 0.45rem 0.8rem 0.45rem 0.6rem;
	border: 1.5px solid var(--em-line);
	border-radius: 999px;
	background: var(--wp--preset--color--white);
	font-weight: 600;
	font-size: 1rem;
	line-height: 1;
}
.em-header .wp-block-navigation__responsive-container-open::after { content: "Menu"; }
.em-header .wp-block-navigation__responsive-container-open:hover { border-color: var(--em-blue); }
.em-header .wp-block-navigation__responsive-container-open svg { width: 24px; height: 24px; }

/* Phones: keep the Book button, just smaller */
@media (max-width: 600px) {
	.em-header .wp-block-image.em-logo img { width: 128px; }
	.em-header .em-header__book .wp-block-button__link {
		font-size: 0.9375rem;
		padding: 0.55em 0.95em;
		white-space: nowrap;
	}
	.em-header .em-header__book .wp-block-button__link:hover { transform: none; }
	.em-header > .wp-block-group > .wp-block-group > .wp-block-group { gap: 0.5rem !important; }
	.em-header .wp-block-navigation__responsive-container-open { padding: 0.5rem; }
	.em-header .wp-block-navigation__responsive-container-open::after { content: none; }
	.em-header .em-header__book { order: -1; }
}
@media (max-width: 370px) {
	.em-header .wp-block-image.em-logo img { width: 112px; }
	.em-header .em-header__book .wp-block-button__link { font-size: 0.875rem; padding: 0.5em 0.8em; }
}

/* ------------------------------------------------------------------
   Phone / tablet menu (overlay)
------------------------------------------------------------------- */
.wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--white) !important;
	color: var(--wp--preset--color--ink) !important;
	padding: 0 !important;
	animation: em-menu-in 0.18s ease-out;
}
@keyframes em-menu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close {
	max-width: 34rem;
	margin: 0 auto;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
	padding: 1rem 1.25rem 2rem;
	position: relative;
}
/* Logo at the top of the menu, level with the close button */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog::before {
	content: "";
	display: block;
	height: 44px;
	width: 130px;
	background: url("assets/images/logo.png") left center / contain no-repeat;
	margin-bottom: 0.75rem;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	top: 1rem;
	right: 1.25rem;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--wp--preset--color--paper-deep);
	display: flex;
	align-items: center;
	justify-content: center;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close svg { width: 26px; height: 26px; }

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: 0 !important;
	align-items: stretch !important;
	gap: 0 !important;
	font-size: 1.125rem;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	align-items: stretch !important;
	gap: 0 !important;
	width: 100%;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	align-items: stretch !important;
	width: 100%;
	text-align: left;
}
/* Top-level rows */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container > .wp-block-navigation-item:not(:has(> .em-nav-extras)) {
	border-bottom: 1px solid var(--em-line);
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content,
.wp-block-navigation__responsive-container.is-menu-open .em-acc-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: 3.4rem;
	box-sizing: border-box;
	padding: 0.75rem 0.25rem !important;
	font-weight: 600;
	color: var(--em-blue);
	text-decoration: none;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content:hover { text-decoration: underline; }

/* Submenus inside the overlay: an indented list, no floating boxes */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	background: transparent !important;
	border: 0 !important;
	border-left: 3px solid var(--wp--preset--color--peach) !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	margin: 0 0 0.9rem 0.35rem !important;
	padding: 0 0 0 0.9rem !important;
	min-width: 0 !important;
	gap: 0 !important;
	font-size: 1.0625rem;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0.6rem 0 !important;
	color: var(--wp--preset--color--ink);
	font-weight: 400;
	text-decoration: none;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
	color: var(--em-blue);
	text-decoration: underline;
}

/* Accordion (switched on by assets/js/menu.js; without JS everything simply stays open) */
.em-acc-toggle { display: none; }
.wp-block-navigation__responsive-container.is-menu-open .em-acc-toggle {
	background: none;
	border: 0;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	text-align: left;
}
.wp-block-navigation__responsive-container.is-menu-open .em-acc-toggle::after {
	content: "";
	flex: none;
	width: 1.9rem;
	height: 1.9rem;
	border-radius: 50%;
	background: var(--wp--preset--color--paper-deep) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231C2733' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") center / 62% no-repeat;
	transition: transform 0.2s ease;
}
.wp-block-navigation__responsive-container.is-menu-open .em-acc-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
.wp-block-navigation__responsive-container.is-menu-open .em-acc-ready > .wp-block-navigation-item__content,
.wp-block-navigation__responsive-container.is-menu-open .em-acc-ready > .wp-block-navigation__submenu-icon { display: none !important; }
.wp-block-navigation__responsive-container.is-menu-open .em-acc-ready:not(.em-acc-open) > .wp-block-navigation__submenu-container { display: none !important; }

/* Book / Call / 111 at the bottom of the phone menu */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:has(> .em-nav-extras),
.wp-block-navigation__responsive-container.is-menu-open .em-nav-extras { display: flex; }
.wp-block-navigation__responsive-container.is-menu-open .em-nav-extras {
	flex-direction: column;
	align-items: stretch;
	gap: 0.6rem;
	width: 100%;
	margin-top: 1.5rem;
}
.wp-block-navigation__responsive-container.is-menu-open .em-nav-extras .wp-block-button { width: 100%; }
.wp-block-navigation__responsive-container.is-menu-open .em-nav-extras .wp-block-button__link {
	display: block;
	width: 100%;
	text-align: center;
	font-size: 1.0625rem;
	box-sizing: border-box;
}
.wp-block-navigation__responsive-container.is-menu-open .em-nav-extras .em-nav-extras__111 .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--pohutukawa);
	padding: 0.4em;
	font-size: var(--wp--preset--font-size--small);
	box-shadow: none;
}

@media (min-width: 600px) {
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
		max-width: 34rem;
		margin: 0 auto;
		padding-top: 1.5rem;
	}
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close { top: 1.5rem; }
}

/* ------------------------------------------------------------------
   Page title band (soft blue, gentle wave underneath)
------------------------------------------------------------------- */
.em-title-band { position: relative; }
.em-title-band::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 18px;
	background: var(--wp--preset--color--paper);
	-webkit-mask: var(--em-wave) bottom / 320px 18px repeat-x;
	mask: var(--em-wave) bottom / 320px 18px repeat-x;
}
.em-title-band .wp-block-post-title,
.em-title-band h1 { margin: 0; font-size: var(--wp--preset--font-size--xx-large); }
.em-title-band .wp-block-query-title { margin: 0; }
.em-eyebrow {
	font-size: 0.8125rem;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--em-orange);
	margin-bottom: 0.25rem !important;
}

/* ------------------------------------------------------------------
   Block styles
------------------------------------------------------------------- */

/* Group: card */
.wp-block-group.is-style-card {
	background: var(--wp--preset--color--white);
	border: 1px solid var(--em-line);
	border-radius: var(--em-radius);
	box-shadow: var(--wp--preset--shadow--soft);
	padding: var(--wp--preset--spacing--40);
	transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.wp-block-group.is-style-card:has(a):hover {
	box-shadow: var(--wp--preset--shadow--lift);
	border-color: #D9CDBC;
}
.wp-block-group.is-style-card > :first-child { margin-top: 0; }
.wp-block-group.is-style-card > :last-child { margin-bottom: 0; }

/* Group: notice (seasonal updates etc.) */
.wp-block-group.is-style-notice {
	background: var(--wp--preset--color--peach);
	border-radius: var(--em-radius);
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
	position: relative;
	overflow: hidden;
	isolation: isolate;
}
.wp-block-group.is-style-notice::after {
	/* a soft pōhutukawa-ish glow in the corner */
	content: "";
	position: absolute;
	right: -4rem;
	top: -4rem;
	width: 14rem;
	height: 14rem;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%);
	z-index: -1;
}
.wp-block-group.is-style-notice a:not(.wp-element-button) { color: var(--wp--preset--color--orange-dark); }
.wp-block-group.is-style-notice > :first-child { margin-top: 0; }
.wp-block-group.is-style-notice > :last-child { margin-bottom: 0; }
.wp-block-group.is-style-notice h2 { font-size: var(--wp--preset--font-size--x-large); margin-top: 0.1rem; }

/* Group: urgent (111 / emergencies) */
.wp-block-group.is-style-urgent {
	background: color-mix(in srgb, var(--wp--preset--color--pohutukawa) 10%, #fff);
	border-left: 6px solid var(--wp--preset--color--pohutukawa);
	border-radius: 6px var(--em-radius-sm) var(--em-radius-sm) 6px;
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	color: var(--wp--preset--color--ink);
}
.wp-block-group.is-style-urgent > :first-child { margin-top: 0; }
.wp-block-group.is-style-urgent > :last-child { margin-bottom: 0; }
.wp-block-group.is-style-urgent strong { color: var(--wp--preset--color--pohutukawa); }

/* Image: critter (the doctors' little spirit animals) */
.wp-block-image.is-style-critter img {
	border-radius: 0 !important;
	transform: rotate(-4deg);
	transition: transform 0.3s ease;
	filter: drop-shadow(0 3px 4px rgba(28, 39, 51, 0.15));
}
.wp-block-image.is-style-critter:hover img { transform: rotate(3deg) scale(1.05); }

/* Image: portrait (team photos) */
.wp-block-image.is-style-portrait img {
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: 50%;
	border: 5px solid var(--wp--preset--color--white);
	box-shadow: 0 0 0 1px var(--em-line), var(--wp--preset--shadow--soft);
}

/* Image: plain (logos, diagrams) */
.wp-block-image.is-style-plain img { border-radius: 0 !important; }

/* Separator: wave */
.wp-block-separator.is-style-wave {
	border: none !important;
	height: 14px;
	max-width: 12rem;
	background: currentColor;
	color: var(--em-orange);
	opacity: 0.8;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 14'%3E%3Cpath d='M1 7 C 7 1, 13 1, 19 7 S 31 13, 37 7 S 45 3, 47 5' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") left center / 48px 14px repeat-x;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 14'%3E%3Cpath d='M1 7 C 7 1, 13 1, 19 7 S 31 13, 37 7 S 45 3, 47 5' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") left center / 48px 14px repeat-x;
}
.wp-block-separator.is-style-wave.aligncenter, .has-text-align-center + .wp-block-separator.is-style-wave { margin-left: auto; margin-right: auto; }

/* List: plain (no bullets) */
ul.is-style-plain { list-style: none; padding-left: 0; }
ul.is-style-plain li + li { margin-top: 0.85rem; }

/* List: ticks */
ul.is-style-ticks { list-style: none; padding-left: 0; }
ul.is-style-ticks li { position: relative; padding-left: 1.9rem; }
ul.is-style-ticks li + li { margin-top: 0.45rem; }
ul.is-style-ticks li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.3em;
	width: 1.25em;
	height: 1.25em;
	border-radius: 50%;
	background: var(--wp--preset--color--flax) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 72% no-repeat;
}

/* Table: hours (compact, borderless) */
.wp-block-table.is-style-hours table { border-collapse: collapse; width: auto; min-width: 14rem; }
.wp-block-table.is-style-hours td, .wp-block-table.is-style-hours th { border: none; padding: 0.2rem 1.5rem 0.2rem 0; text-align: left; }
.wp-block-table.is-style-hours tr > :first-child { font-weight: 600; }

/* ------------------------------------------------------------------
   Icons for cards (add class em-icon-<name> to a Group)
------------------------------------------------------------------- */
[class*="em-icon-"] { --em-ico: none; }
.em-icon-clock    { --em-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3.5 2'/%3E%3C/svg%3E"); }
.em-icon-calendar { --em-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2.5'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18M8 14h2M14 14h2M8 17.5h2'/%3E%3C/svg%3E"); }
.em-icon-heart    { --em-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20s-7.5-4.6-7.5-10.2A4.3 4.3 0 0 1 12 7.2a4.3 4.3 0 0 1 7.5 2.6C19.5 15.4 12 20 12 20z'/%3E%3C/svg%3E"); }
.em-icon-portal   { --em-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4.5' width='16' height='11.5' rx='1.8'/%3E%3Cpath d='M2 19.5h20M10 10l1.5 1.5L15 8'/%3E%3C/svg%3E"); }
.em-icon-phone    { --em-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3.5h3.2l1.9 4.8-2.4 1.5a11.5 11.5 0 0 0 6.5 6.5l1.5-2.4 4.8 1.9V19a2 2 0 0 1-2.1 2A17 17 0 0 1 3 5.6a2 2 0 0 1 2-2.1z'/%3E%3C/svg%3E"); }
.em-icon-pin      { --em-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21.5s-7-6.3-7-11.5a7 7 0 0 1 14 0c0 5.2-7 11.5-7 11.5z'/%3E%3Ccircle cx='12' cy='10' r='2.5'/%3E%3C/svg%3E"); }
.em-icon-people   { --em-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.2'/%3E%3Cpath d='M3 20c0-3.6 2.7-6 6-6s6 2.4 6 6'/%3E%3Ccircle cx='17' cy='9.5' r='2.4'/%3E%3Cpath d='M16 14.2c2.8.2 5 2.3 5 5.3'/%3E%3C/svg%3E"); }
.em-icon-leaf     { --em-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 19C5 10 10 5 20 4c-.5 10-5.5 15-14 15z'/%3E%3Cpath d='M5 19c3-4 6-7 10-10'/%3E%3C/svg%3E"); }

/* Card icon: brand-blue line icon in a soft blue circle */
.wp-block-group[class*="em-icon-"] { position: relative; z-index: 0; isolation: isolate; }
.wp-block-group[class*="em-icon-"] > :first-child { position: relative; }
.wp-block-group[class*="em-icon-"] > :first-child::before {
	content: "";
	display: block;
	width: 3rem;
	height: 3rem;
	margin-bottom: 0.9rem;
	background: var(--em-blue);
	-webkit-mask: var(--em-ico) center / 56% no-repeat;
	mask: var(--em-ico) center / 56% no-repeat;
}
.wp-block-group[class*="em-icon-"] > :first-child::after {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	width: 3rem;
	height: 3rem;
	border-radius: 50%;
	background: var(--wp--preset--color--villa);
	z-index: -1;
}
.wp-block-group[class*="em-icon-"] h3 { font-size: var(--wp--preset--font-size--large); margin-bottom: 0.4rem; }
.wp-block-group[class*="em-icon-"] p { color: #3A4552; }
@media (max-width: 600px) {
	/* Phones: icon sits beside the text so the four cards aren't so tall */
	.wp-block-group.is-style-card[class*="em-icon-"] { padding-left: calc(var(--wp--preset--spacing--40) + 3.4rem); }
	.wp-block-group[class*="em-icon-"] > :first-child::before,
	.wp-block-group[class*="em-icon-"] > :first-child::after {
		position: absolute;
		left: -3.4rem;
		top: -0.2rem;
		width: 2.6rem;
		height: 2.6rem;
		margin: 0;
	}
	.wp-block-group[class*="em-icon-"] h3 { margin-bottom: 0.25rem; }
}

/* ------------------------------------------------------------------
   Home page bits
------------------------------------------------------------------- */
.em-hero { position: relative; overflow: hidden; isolation: isolate; }
.em-hero::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 18px;
	background: var(--wp--preset--color--paper);
	-webkit-mask: var(--em-wave) bottom / 320px 18px repeat-x;
	mask: var(--em-wave) bottom / 320px 18px repeat-x;
}
.em-hero::before {
	/* a large, very soft circle behind the picture – the villa's blue */
	content: "";
	position: absolute;
	right: -10vw;
	top: -30%;
	width: 60vw;
	height: 60vw;
	max-width: 52rem;
	max-height: 52rem;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 65%);
	z-index: -1;
	pointer-events: none;
}
.em-hero h1, .em-hero .em-hero__greeting {
	font-size: var(--wp--preset--font-size--display);
	line-height: 1.02;
	letter-spacing: -0.02em;
	margin-bottom: 0.75rem;
	color: var(--em-blue);
}
.em-hero .em-hero__greeting em { color: var(--em-orange); font-style: normal; }
.em-hero .has-large-font-size { color: #2E3A47; max-width: 34rem; }
.em-hero .wp-block-image { position: relative; margin: 0 0.9rem 0.9rem 0; }
.em-hero .wp-block-image img {
	position: relative;
	box-shadow: 14px 14px 0 var(--wp--preset--color--peach), var(--wp--preset--shadow--lift);
	aspect-ratio: 16 / 10;
	object-fit: cover;
	object-position: 54% 50%;
	width: 100%;
	border-radius: 24px;
}
@media (max-width: 781px) {
	.em-hero .wp-block-image img { aspect-ratio: 16 / 9; box-shadow: 10px 10px 0 var(--wp--preset--color--peach); }
	.em-hero .wp-block-buttons { gap: 0.6rem; }
}
@media (max-width: 480px) {
	.em-hero .wp-block-buttons > .wp-block-button,
	.is-style-card .wp-block-buttons > .wp-block-button { flex: 1 1 100%; }
	.em-hero .wp-block-buttons .wp-block-button__link,
	.is-style-card .wp-block-buttons .wp-block-button__link { width: 100%; text-align: center; box-sizing: border-box; }
}

.em-stamp {
	display: inline-block;
	padding: 0.35rem 0.85rem;
	border: 2px dashed var(--wp--preset--color--flax);
	color: var(--wp--preset--color--flax);
	border-radius: 999px;
	font-weight: 600;
	font-size: var(--wp--preset--font-size--small);
	transform: rotate(-1.5deg);
}

/* Team cards */
.em-team-card { text-align: center; }
.em-team-card .wp-block-image { margin-left: auto; margin-right: auto; max-width: 13rem; }
.em-team-card h3 { margin-bottom: 0.15rem; font-size: var(--wp--preset--font-size--large); }
.em-team-card h3 a { color: var(--em-blue); text-decoration: none; }
.em-team-card h3 a:hover { text-decoration: underline; }
.em-team-card p { margin-top: 0.15rem; margin-bottom: 0.15rem; }
.em-team-card .em-quals { color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--small); }
.em-team-card .wp-block-image a { display: block; transition: transform 0.25s ease; }
.em-team-card .wp-block-image a:hover { transform: translateY(-3px) scale(1.02); }

/* Profile pages */
.em-profile-meta { color: var(--wp--preset--color--muted); }
.em-sessions table { width: 100%; }
.em-sessions td:first-child { font-weight: 600; }

/* ------------------------------------------------------------------
   Details / accordions (Policies, Health links, calculators)
------------------------------------------------------------------- */
.wp-block-details {
	border-top: 1px solid var(--em-line);
	padding: 0;
}
.wp-block-details + :not(.wp-block-details) { border-top: 1px solid var(--em-line); padding-top: var(--wp--preset--spacing--30); }
.wp-block-details summary {
	cursor: pointer;
	list-style: none;
	position: relative;
	padding: 1.05rem 3rem 1.05rem 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	color: var(--em-blue);
	transition: color 0.15s ease;
}
.wp-block-details summary::-webkit-details-marker { display: none; }
.wp-block-details summary::after {
	content: "";
	position: absolute;
	right: 0.5rem;
	top: 50%;
	width: 1.75rem;
	height: 1.75rem;
	margin-top: -0.875rem;
	border-radius: 50%;
	background: var(--wp--preset--color--villa) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231C2733' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 6v12M6 12h12'/%3E%3C/svg%3E") center / 62% no-repeat;
	transition: transform 0.2s ease, background-color 0.2s ease;
}
.wp-block-details[open] summary::after { transform: rotate(45deg); background-color: var(--wp--preset--color--peach); }
.wp-block-details summary:hover { color: var(--em-orange); }
.wp-block-details > :not(summary) { margin-left: 0; }
.wp-block-details[open] { padding-bottom: 1.25rem; }
.em-details-group { border-bottom: 1px solid var(--em-line); }

/* ------------------------------------------------------------------
   Tables
------------------------------------------------------------------- */
.wp-block-table { overflow-x: auto; }
.wp-block-table table { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--wp--preset--color--white); }
.wp-block-table:not(.is-style-hours) table {
	border: 1px solid var(--em-line);
	border-radius: 14px;
	overflow: hidden;
}
.wp-block-table:not(.is-style-hours) th,
.wp-block-table:not(.is-style-hours) td {
	border: 0;
	border-bottom: 1px solid var(--em-line);
	padding: 0.7rem 0.9rem;
	vertical-align: top;
	text-align: left;
}
.wp-block-table:not(.is-style-hours) tbody tr:last-child > * { border-bottom: 0; }
.wp-block-table:not(.is-style-hours) thead th,
.wp-block-table:not(.is-style-hours) thead td {
	background: var(--em-blue);
	color: var(--wp--preset--color--white);
	font-weight: 600;
	border-bottom: 0;
}
.wp-block-table thead { border-bottom: none; }
.wp-block-table:not(.is-style-hours) tbody tr:nth-child(even) { background: color-mix(in srgb, var(--wp--preset--color--paper-deep) 45%, #fff); }
.wp-block-table td ul { margin: 0; padding-left: 1.1rem; }
.wp-block-table figcaption { text-align: left; }
.em-fees-table td:not(:first-child), .em-fees-table th:not(:first-child) { text-align: center !important; }
.em-fees-table tbody tr td:first-child { font-weight: 600; white-space: nowrap; }

/* ------------------------------------------------------------------
   News lists
------------------------------------------------------------------- */
.em-news-list .wp-block-post { padding: var(--wp--preset--spacing--30) 0; border-bottom: 1px solid var(--em-line); }
.em-news-list .wp-block-post:first-child { padding-top: 0; }
.em-news-list .wp-block-post-title { font-size: var(--wp--preset--font-size--x-large); margin: 0.2rem 0; }
.em-news-list .wp-block-post-title a { color: var(--em-blue); text-decoration: none; }
.em-news-list .wp-block-post-title a:hover { text-decoration: underline; }
.em-news-list .wp-block-post-excerpt__excerpt { margin: 0.3rem 0 0; }
.em-news-cards .wp-block-post-title { font-size: var(--wp--preset--font-size--large); margin: 0.3rem 0 0.5rem; }
.em-news-cards .wp-block-post-excerpt { font-size: var(--wp--preset--font-size--small); color: #3A4552; }
.em-news-cards .wp-block-post-date,
.em-news-list .wp-block-post-date {
	display: inline-block;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--em-orange);
}
.wp-block-post-title a { color: var(--em-blue); text-decoration: none; }
.wp-block-post-title a:hover { text-decoration: underline; }
.em-news-cards .wp-block-post { height: 100%; }
.em-news-cards .wp-block-post > .wp-block-group { height: 100%; box-sizing: border-box; position: relative; }
/* Whole news card is clickable */
.em-news-cards .wp-block-post-title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.em-news-cards .wp-block-post > .wp-block-group:hover { transform: translateY(-2px); }
.wp-block-query-pagination { font-weight: 600; }

/* ------------------------------------------------------------------
   Footer
------------------------------------------------------------------- */
.em-footer { position: relative; }
.em-footer.has-navy-background-color { background-color: var(--em-blue-deep) !important; }
.em-footer::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -17px;
	height: 18px;
	background: var(--em-blue-deep);
	-webkit-mask: var(--em-wave-up) bottom / 320px 18px repeat-x;
	mask: var(--em-wave-up) bottom / 320px 18px repeat-x;
}
.em-footer a { color: #fff; }
.em-footer a:hover { color: var(--em-on-dark-accent); }
.em-footer h2 {
	color: #fff;
	font-size: var(--wp--preset--font-size--large);
	margin-bottom: 0.75rem;
}
.em-footer h2::after {
	content: "";
	display: block;
	width: 2rem;
	height: 3px;
	margin-top: 0.5rem;
	border-radius: 3px;
	background: var(--em-on-dark-accent);
	opacity: 0.85;
}
.em-footer .wp-block-table.is-style-hours table { background: transparent; }
.em-footer .wp-block-table.is-style-hours td { padding-top: 0.1rem; padding-bottom: 0.1rem; }
.em-footer p { margin-top: 0.35rem; margin-bottom: 0.35rem; }
.em-footer ul.em-footer__links,
.em-footer .em-footer__links ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1.4rem;
	list-style: none;
	padding: 0;
	margin: 0;
}
.em-footer ul.em-footer__links a { text-decoration: none; font-weight: 500; }
.em-footer ul.em-footer__links a:hover { text-decoration: underline; }
.em-footer .em-footer__note { color: var(--em-on-dark-muted); }
.em-footer .em-footer__rule { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.2); opacity: 1; margin: var(--wp--preset--spacing--40) 0 var(--wp--preset--spacing--30); }
.em-footer .em-footer__map img { border: 4px solid #fff; border-radius: var(--em-radius-sm); }
.em-footer .em-footer__111 {
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 12px;
	padding: 0.75rem 1rem;
}
.em-footer .em-footer__111 strong { color: var(--em-on-dark-accent); }
@media (max-width: 781px) {
	.em-footer .wp-block-columns { row-gap: var(--wp--preset--spacing--40); }
}

/* ------------------------------------------------------------------
   Contact Form 7 (keeps working with the practice's existing forms)
------------------------------------------------------------------- */
.wpcf7 { max-width: 42rem; }
.wpcf7 #responsive-form .form-row { display: grid; gap: 0 1.25rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.wpcf7 label { display: block; font-weight: 600; margin-bottom: 0.9rem; }
.wpcf7 input[type="text"], .wpcf7 input[type="email"], .wpcf7 input[type="tel"], .wpcf7 input[type="date"], .wpcf7 textarea, .wpcf7 select {
	width: 100%;
	margin-top: 0.3rem;
	padding: 0.75rem 0.85rem;
	font: inherit;
	font-weight: 400;
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--white);
	border: 1.5px solid #D9CFC1;
	border-radius: var(--em-radius-sm);
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.wpcf7 input:focus, .wpcf7 textarea:focus, .wpcf7 select:focus {
	border-color: var(--em-blue);
	box-shadow: 0 0 0 3px var(--wp--preset--color--villa);
	outline: none;
}
.wpcf7 textarea { min-height: 9rem; }
.wpcf7 .file-row { background: var(--wp--preset--color--paper-deep); border-radius: var(--em-radius-sm); padding: 1rem; margin: 0.5rem 0 1rem; }
.wpcf7 .file-row p { margin: 0.4rem 0; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.wpcf7 .file-row p[hidden], .wpcf7 .file-row a[hidden] { display: none !important; }
.wpcf7 .file-row .del_file { font-size: var(--wp--preset--font-size--small); }
.wpcf7 .file-row .add_file { font-weight: 600; }
.wpcf7 .checkbox-row { margin: 1rem 0 !important; }
.wpcf7 .wpcf7-list-item { margin-left: 0; }
.wpcf7 input[type="submit"] {
	background: var(--em-orange);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 0.8rem 1.8rem;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.wpcf7 input[type="submit"]:hover { background: var(--wp--preset--color--orange-dark); }
.wpcf7 .wpcf7-not-valid-tip { color: var(--wp--preset--color--pohutukawa); font-weight: 600; }
.wpcf7 form .wpcf7-response-output { border-radius: var(--em-radius-sm); margin: 1rem 0; padding: 0.75rem 1rem; }
.em-form-fallback { background: var(--wp--preset--color--villa); border-radius: var(--em-radius); padding: var(--wp--preset--spacing--40); }

/* ------------------------------------------------------------------
   Paediatric dose calculator
------------------------------------------------------------------- */
.em-calculator {
	background: var(--wp--preset--color--white);
	border: 1px solid var(--em-line);
	border-radius: var(--em-radius);
	box-shadow: var(--wp--preset--shadow--soft);
	padding: var(--wp--preset--spacing--40);
}
.em-calculator .drug_calc { display: grid; gap: 0.4rem; }
.em-calculator label { font-weight: 600; margin-top: 0.6rem; }
.em-calculator input[type="number"], .em-calculator select {
	font: inherit;
	padding: 0.75rem 0.85rem;
	border: 1.5px solid #D9CFC1;
	border-radius: var(--em-radius-sm);
	background: var(--wp--preset--color--white);
	width: 100%;
	box-sizing: border-box;
}
.em-calculator input[type="number"]:focus, .em-calculator select:focus {
	border-color: var(--em-blue);
	box-shadow: 0 0 0 3px var(--wp--preset--color--villa);
	outline: none;
}
.em-calculator #calcbutton {
	margin-top: 1rem;
	font: inherit;
	font-weight: 700;
	background: var(--em-orange);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 0.8rem 1.6rem;
	cursor: pointer;
	justify-self: start;
}
.em-calculator #calcbutton:hover { background: var(--wp--preset--color--orange-dark); }
.em-calculator .resultBox {
	margin-top: 1rem;
	padding: 1rem 1.2rem;
	background: var(--wp--preset--color--villa);
	border-radius: var(--em-radius-sm);
	font-weight: 600;
	line-height: 1.5;
}
.em-calculator #ResultMgs { background: var(--wp--preset--color--paper-deep); font-weight: 500; }

/* ------------------------------------------------------------------
   Embeds (calculators hosted on jackofallorgans.com, maps)
------------------------------------------------------------------- */
.em-embed iframe { width: 100%; border: 0; border-radius: var(--em-radius-sm); background: var(--wp--preset--color--white); }

/* ------------------------------------------------------------------
   Search
------------------------------------------------------------------- */
.wp-block-search__input {
	border: 1.5px solid #D9CFC1;
	border-radius: 999px;
	padding: 0.65rem 1rem;
	font: inherit;
}
.wp-block-search__button { border-radius: 999px; }

/* ------------------------------------------------------------------
   Motion and print
------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
	.em-topbar, .em-header .wp-block-navigation, .em-header__book, .em-footer::before, .em-footer .em-footer__links { display: none !important; }
	.em-footer { background: none !important; color: #000 !important; }
	.em-footer a, .em-footer h2 { color: #000 !important; }
	a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
	.wp-block-details { display: block; }
}
