/*
Theme Name: EduMed
Theme URI: https://edumedltd.co.uk
Author: 83blue
Description: Purpose-built theme for EduMed Limited, rebuilt from the original Squarespace site. Section-based editing with EduMed brand colours, Roboto typography and ready-made EduMed patterns.
Version: 1.1.2
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: edumed
*/

/* ============================================================
   Section themes (match the five Squarespace section palettes)
   Applied to Group blocks via Styles: White / Pale / Bright / Blue / Black
   ============================================================ */

.edumed-section {
	padding-top: var(--wp--preset--spacing--60);
	padding-bottom: var(--wp--preset--spacing--60);
}

.is-style-section-white,
.is-style-section-pale,
.is-style-section-bright,
.is-style-section-blue,
.is-style-section-black {
	padding-top: var(--wp--preset--spacing--60);
	padding-bottom: var(--wp--preset--spacing--60);
}

.is-style-section-white {
	--edumed-btn-bg: var(--wp--preset--color--black);
	--edumed-btn-text: var(--wp--preset--color--white);
	--edumed-btn-bg-hover: #2a2a2a;
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--black);
}

.is-style-section-pale {
	--edumed-btn-bg: var(--wp--preset--color--black);
	--edumed-btn-text: var(--wp--preset--color--white);
	--edumed-btn-bg-hover: #2a2a2a;
	background-color: var(--wp--preset--color--pale-grey);
	color: var(--wp--preset--color--black);
}

.is-style-section-bright {
	--edumed-btn-bg: var(--wp--preset--color--black);
	--edumed-btn-text: var(--wp--preset--color--sky-blue);
	--edumed-btn-bg-hover: #1c1c1c;
	background-color: var(--wp--preset--color--sky-blue);
	color: var(--wp--preset--color--black);
}

.is-style-section-blue {
	--edumed-btn-bg: var(--wp--preset--color--sky-blue);
	--edumed-btn-text: var(--wp--preset--color--black);
	--edumed-btn-bg-hover: #a5c6e4;
	background-color: var(--wp--preset--color--edumed-blue);
	color: var(--wp--preset--color--white);
}

.is-style-section-black {
	--edumed-btn-bg: var(--wp--preset--color--sky-blue);
	--edumed-btn-text: var(--wp--preset--color--black);
	--edumed-btn-bg-hover: #a5c6e4;
	background-color: var(--wp--preset--color--black);
	color: var(--wp--preset--color--white);
}

.is-style-section-blue a:not(.wp-block-button__link),
.is-style-section-black a:not(.wp-block-button__link) {
	color: var(--wp--preset--color--sky-blue);
}

/* Buttons pick up the section variables */
.wp-block-button__link {
	background-color: var(--edumed-btn-bg, var(--wp--preset--color--black));
	color: var(--edumed-btn-text, var(--wp--preset--color--white));
	transition: background-color 0.15s ease, opacity 0.15s ease;
}
.wp-block-button__link:hover {
	background-color: var(--edumed-btn-bg-hover, #2a2a2a);
	color: var(--edumed-btn-text, var(--wp--preset--color--white));
}

/* ============================================================
   Rounded imagery (Squarespace fluid-engine cards use ~20px radii)
   ============================================================ */
.edumed-rounded img,
img.edumed-rounded,
.edumed-rounded video {
	border-radius: 20px;
}
.wp-block-image.edumed-rounded {
	overflow: hidden;
}

/* ============================================================
   Header
   ============================================================ */
.edumed-header {
	padding-top: clamp(1rem, 2vw, 2rem);
	padding-bottom: clamp(1rem, 2vw, 2rem);
}
.edumed-header .wp-block-navigation a:hover {
	text-decoration: underline;
	text-underline-offset: 0.35em;
}

/* Announcement bar */
.edumed-announcement {
	background-color: var(--wp--preset--color--edumed-blue);
	color: var(--wp--preset--color--white);
	text-align: center;
	font-size: 0.95rem;
	padding: 0.65em clamp(1.25rem, 4vw, 5rem);
}
.edumed-announcement a {
	color: inherit;
	text-decoration: underline;
}

/* ============================================================
   Marquee strip (Educate * Support * Collaborate)
   ============================================================ */
.edumed-marquee {
	overflow: hidden;
	display: flex;
	flex-wrap: nowrap;
	gap: 0;
	border-top: 1px solid currentColor;
	border-bottom: 1px solid currentColor;
	padding-top: 0.35em;
	padding-bottom: 0.35em;
	white-space: nowrap;
}
.edumed-marquee > p {
	flex: 0 0 auto;
	min-width: 100%;
	margin: 0;
	padding-right: 0.6em;
	animation: edumed-marquee 30s linear infinite;
	font-size: var(--wp--preset--font-size--xx-large);
	line-height: 1.4;
}
@keyframes edumed-marquee {
	from { transform: translateX(0); }
	to   { transform: translateX(-100%); }
}
@media (prefers-reduced-motion: reduce) {
	.edumed-marquee > p { animation: none; }
	.edumed-marquee > p + p { display: none; }
}

/* ============================================================
   Enquiry form
   ============================================================ */
.edumed-form {
	max-width: 680px;
}
.edumed-form-notice {
	display: flex;
	align-items: center;
	gap: 0.75em;
	max-width: 680px;
	background-color: #e1f4e6;
	border: 1px solid #2f9e5b;
	border-radius: 16px;
	color: #14532d;
	font-weight: 600;
	padding: 1em 1.3em;
	margin-bottom: 1.5rem;
}
.edumed-form-notice[role="status"]::before {
	content: "\2713";
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.7em;
	height: 1.7em;
	border-radius: 50%;
	background-color: #2f9e5b;
	color: #ffffff;
	font-size: 0.9em;
}
.edumed-form-notice[role="alert"] {
	background-color: #fbeae8;
	border-color: #c4442a;
	color: #7c2d12;
}
@keyframes edumed-notice-in {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
}
@media (prefers-reduced-motion: no-preference) {
	.edumed-form-notice {
		animation: edumed-notice-in 0.4s ease-out;
	}
}
.edumed-form label {
	display: block;
	margin-bottom: 0.35em;
	font-size: 0.95rem;
}
.edumed-form .edumed-form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}
@media (max-width: 640px) {
	.edumed-form .edumed-form-row { grid-template-columns: 1fr; }
}
.edumed-form .edumed-field {
	margin-bottom: 1.35rem;
}
.edumed-form input[type="text"],
.edumed-form input[type="email"],
.edumed-form textarea {
	width: 100%;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 24px;
	color: inherit;
	font: inherit;
	padding: 0.85em 1.2em;
}
.edumed-form textarea {
	min-height: 9em;
	resize: vertical;
}
.edumed-form input:focus,
.edumed-form textarea:focus {
	outline: 2px solid var(--wp--preset--color--edumed-blue);
	outline-offset: 2px;
}
.edumed-form .edumed-required {
	opacity: 0.65;
	font-size: 0.85em;
	margin-left: 0.35em;
}
.edumed-form button[type="submit"] {
	background-color: var(--edumed-btn-bg, var(--wp--preset--color--black));
	color: var(--edumed-btn-text, var(--wp--preset--color--white));
	border: none;
	border-radius: 10rem;
	cursor: pointer;
	font-family: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	line-height: 1.2;
	padding: 1.15em 2.6em;
	transition: background-color 0.15s ease;
}
.edumed-form button[type="submit"]:hover {
	background-color: var(--edumed-btn-bg-hover, #2a2a2a);
}
.edumed-form .edumed-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.edumed-form-notice {
	border: 1px solid currentColor;
	border-radius: 12px;
	padding: 0.9em 1.2em;
	margin-bottom: 1.5rem;
}

/* ============================================================
   Video cards (Videos page grid + single video)
   ============================================================ */
.edumed-video-grid .edumed-video-meta {
	font-size: 0.8125rem;
	letter-spacing: 0;
	margin-bottom: 0.4em;
}
.edumed-video-grid .wp-block-post-title {
	font-size: var(--wp--preset--font-size--x-large);
	line-height: 1.15;
	margin: 0.25em 0 0.3em;
}
.edumed-video-grid .wp-block-post-title a {
	text-decoration: none;
}
.edumed-video-grid .wp-block-post-title a:hover {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}
.edumed-video-grid .wp-block-post-excerpt {
	font-size: 1rem;
}
.edumed-video-grid .wp-block-post-featured-image img {
	border-radius: 8px;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}
.single-video .wp-block-video video,
.wp-block-video video {
	border-radius: 8px;
}

/* ============================================================
   Footer
   ============================================================ */
.edumed-footer {
	padding-top: var(--wp--preset--spacing--60);
	padding-bottom: var(--wp--preset--spacing--50);
}
.edumed-footer h2 {
	font-size: var(--wp--preset--font-size--xx-large);
	margin: 0;
}
.edumed-footer .edumed-footer-small {
	font-size: 0.875rem;
	opacity: 0.75;
}

/* ============================================================
   General polish
   ============================================================ */
.wp-site-blocks {
	min-height: 100vh;
}
h1, h2, h3, h4 {
	text-wrap: balance;
}
.entry-content > * + * {
	margin-top: 0;
}

/* Large statement list used on the About page */
.edumed-heading-list li {
	font-size: var(--wp--preset--font-size--huge);
	line-height: 1.1;
	letter-spacing: -0.02em;
}

/* Skip link (accessibility, mirrors the original site) */
.skip-link.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}
.skip-link.screen-reader-text:focus {
	background-color: var(--wp--preset--color--white);
	clip-path: none;
	color: var(--wp--preset--color--black);
	display: block;
	font-size: 0.875rem;
	height: auto;
	left: 5px;
	line-height: normal;
	padding: 15px 23px 14px;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
}

/* Fixes after first QA pass */
.edumed-form input,
.edumed-form textarea,
.edumed-form button {
	box-sizing: border-box;
}
.edumed-team-photo img {
	aspect-ratio: 1 / 1;
	object-fit: cover;
	width: 100%;
	height: auto;
}
.edumed-announcement a {
	text-decoration: none;
}
.edumed-announcement a:hover {
	text-decoration: underline;
}

/* Collapse the navigation to the burger below 1100px: the menu is long,
   and the original site did the same at tablet widths. */
@media (max-width: 1099px) {
	.edumed-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex !important;
	}
	.edumed-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none !important;
	}
}

/* ============================================================
   Dynamic transparent header (Squarespace data-header-style="dynamic")
   The header overlays the first section of every page; its text takes
   the section's ink colour. The announcement bar recolours per page:
   pale first section -> EduMed blue, white -> black, dark/video -> white.
   ============================================================ */
:root {
	--edumed-header-h: calc(2.75rem + clamp(2.5rem, 4vw, 4.5rem));
	--edumed-chrome-ink: #000000;
	--edumed-annc-bg: #1470AF;
	--edumed-annc-ink: #FFFFFF;
	--edumed-overlay-bg: #EAEAEE;
}

/* Dark first section (video/black/blue): white chrome, white announcement bar */
.wp-site-blocks:has(.wp-block-post-content > .wp-block-cover:first-child),
.wp-site-blocks:has(.wp-block-post-content > .is-style-section-black:first-child),
.wp-site-blocks:has(.wp-block-post-content > .is-style-section-blue:first-child),
.wp-site-blocks:has(main.is-style-section-black) {
	--edumed-chrome-ink: #FFFFFF;
	--edumed-annc-bg: #FFFFFF;
	--edumed-annc-ink: #000000;
	--edumed-overlay-bg: #000000;
}

/* White first section: black announcement bar */
.wp-site-blocks:has(.wp-block-post-content > .is-style-section-white:first-child),
.wp-site-blocks:has(main.is-style-section-white) {
	--edumed-annc-bg: #000000;
	--edumed-annc-ink: #FFFFFF;
	--edumed-overlay-bg: #FFFFFF;
}

/* No gap between chrome and content at the page root */
.wp-site-blocks > * {
	margin-block-start: 0;
}

/* The header floats over the page; the announcement bar stays in flow above it */
.wp-block-template-part:has(.edumed-header) {
	position: relative;
}
.edumed-header {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 30;
	background: transparent;
}
.edumed-header .wp-block-site-title a,
.edumed-header .wp-block-navigation a,
.edumed-header .wp-block-navigation__responsive-container-open {
	color: var(--edumed-chrome-ink);
}

/* Announcement bar takes the per-page palette, with a session dismiss button */
.edumed-announcement {
	position: relative;
	background-color: var(--edumed-annc-bg);
	color: var(--edumed-annc-ink);
}
.edumed-announcement-close {
	position: absolute;
	right: 0.9rem;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: 0;
	padding: 0.2em 0.4em;
	color: inherit;
	font: inherit;
	font-size: 1.05rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.85;
}
.edumed-announcement-close:hover {
	opacity: 1;
}

/* First section clears the floating header (its background runs behind it) */
.wp-block-post-content > :first-child:not(.wp-block-cover) {
	padding-top: calc(var(--edumed-header-h) + var(--wp--preset--spacing--60));
}
.wp-block-post-content > .wp-block-cover:first-child {
	padding-top: calc(var(--edumed-header-h) + 1rem);
}
main.edumed-section {
	padding-top: calc(var(--edumed-header-h) + var(--wp--preset--spacing--60));
}

/* Open mobile menu matches the page's chrome palette, as on Squarespace */
.edumed-header .wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--edumed-overlay-bg);
	color: var(--edumed-chrome-ink);
}
.edumed-header .wp-block-navigation__responsive-container.is-menu-open a,
.edumed-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	color: var(--edumed-chrome-ink);
}

/* The navigation block's own colour rules out-rank the chrome ink var; pin it. */
.edumed-header .wp-block-navigation,
.edumed-header .wp-block-navigation .wp-block-navigation-item,
.edumed-header .wp-block-navigation .wp-block-navigation-item__content,
.edumed-header .wp-block-navigation a,
.edumed-header .wp-block-navigation__responsive-container-open {
	color: var(--edumed-chrome-ink) !important;
}
.edumed-header .wp-block-navigation__responsive-container.is-menu-open,
.edumed-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content,
.edumed-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	color: var(--edumed-chrome-ink) !important;
}
