/*
Theme Name: Namalo
Author: Namalo Project
Description: A reusable, accessible Full Site Editing block theme for NGOs, charities, community-based organisations and advocacy groups. Fully editable in the WordPress Site Editor: colours, typography, header, footer, homepage sections and menus. Includes patterns for a hero, introduction, programme cards, impact statistics, news, partner logos and calls to action, plus optional styling for Ultimate Member and GiveWP.
Requires at least: 6.7
Requires PHP: 7.4
Version: 1.1.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: namalo
Tags: full-site-editing, block-patterns, block-styles, custom-colors, custom-logo, custom-menu, editor-style, accessibility-ready, blog, one-column, two-columns, wide-blocks, threaded-comments, translation-ready
*/

/* ==========================================================================
   1. Base
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	overflow-wrap: break-word;
	-webkit-font-smoothing: antialiased;
}

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

/* Page-level wrapper: stop accidental horizontal scroll from full-bleed blocks. */
.wp-site-blocks {
	overflow-x: clip;
}

/* Remove default block-gap margins between the major page regions. */
.wp-site-blocks > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

/* Horizontal gutters for full-width sections (no root-padding dependency). */
.namalo-section {
	padding-left: var(--wp--preset--spacing--30);
	padding-right: var(--wp--preset--spacing--30);
}

/* Post content: gutters for normal blocks, full bleed for .alignfull blocks. */
.namalo-flush > :not(.alignfull) {
	padding-left: var(--wp--preset--spacing--30);
	padding-right: var(--wp--preset--spacing--30);
}

.namalo-flush > .alignfull {
	margin-block-start: 0;
	margin-block-end: 0;
}

.namalo-flush > .alignfull + .alignfull {
	margin-block-start: 0;
}

/* Breathing room above/below normal content in post content. */
.namalo-flush > :not(.alignfull):first-child {
	margin-block-start: var(--wp--preset--spacing--50);
}

.namalo-flush > :not(.alignfull):last-child {
	margin-block-end: var(--wp--preset--spacing--60);
}

/* ==========================================================================
   2. Accessibility
   ========================================================================== */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: var(--wp--custom--namalo--focus, 3px) solid var(--wp--preset--color--primary);
	outline-offset: 3px;
	box-shadow: 0 0 0 6px var(--wp--preset--color--base);
	border-radius: 2px;
}

/* On dark backgrounds the focus ring flips so it stays visible (WCAG 2.4.7 / 2.4.13). */
:where(
	.has-primary-background-color,
	.has-primary-dark-background-color,
	.has-secondary-background-color,
	.has-contrast-background-color,
	.has-burgundy-fade-gradient-background,
	.has-charcoal-fade-gradient-background,
	.wp-block-cover
) :where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline-color: var(--wp--preset--color--base);
	box-shadow: 0 0 0 6px var(--wp--preset--color--primary-dark);
}

/* Minimum target size for icon links (WCAG 2.5.8). */
.wp-block-social-links .wp-social-link a {
	min-width: 24px;
	min-height: 24px;
}

.screen-reader-text,
.namalo-visually-hidden {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

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

/* ==========================================================================
   3. Top utility bar and header
   ========================================================================== */

.namalo-topbar {
	font-size: var(--wp--preset--font-size--small);
}

.namalo-topbar a {
	color: inherit;
	text-decoration: none;
}

.namalo-topbar a:hover {
	text-decoration: underline;
}

.namalo-topbar .wp-block-navigation {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
}

.namalo-topbar .wp-block-navigation a {
	color: var(--wp--preset--color--base);
}

.namalo-topbar .wp-block-social-links {
	gap: 0.5rem;
}

.namalo-header {
	border-bottom: 1px solid var(--wp--preset--color--surface);
	background: var(--wp--preset--color--base);
}

.namalo-header .wp-block-site-logo img {
	width: auto;
	max-height: 64px;
	max-width: 100%;
	height: auto;
	border-radius: 0;
}

/* When a logo has been uploaded, keep the site title for screen readers only. */
.namalo-brand:has(.wp-block-site-logo) .wp-block-site-title {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
}

.namalo-header .wp-block-navigation__responsive-container-open,
.namalo-header .wp-block-navigation__responsive-container-close {
	min-width: 44px;
	min-height: 44px;
}

.namalo-header .wp-block-navigation .wp-block-navigation-item__content {
	padding: 0.5rem 0.25rem;
}

.namalo-header .wp-block-navigation .wp-block-navigation__submenu-container {
	border: 1px solid var(--wp--preset--color--surface);
	box-shadow: var(--wp--preset--shadow--raised);
	border-radius: var(--wp--custom--namalo--radius-small);
	padding: 0.5rem;
}

.namalo-header .wp-block-buttons .wp-block-button__link {
	font-size: var(--wp--preset--font-size--small);
	padding: 0.65em 1.2em;
	white-space: nowrap;
}

.namalo-header .namalo-donate-link .wp-block-button__link {
	background: var(--wp--preset--color--secondary);
}

.namalo-header .is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--primary);
	border: 2px solid var(--wp--preset--color--primary);
}

.namalo-header .is-style-outline .wp-block-button__link:hover,
.namalo-header .is-style-outline .wp-block-button__link:focus {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
}

/* ==========================================================================
   4. Hero and call-to-action covers
   ========================================================================== */

.namalo-hero.wp-block-cover,
.namalo-cta.wp-block-cover {
	padding-left: var(--wp--preset--spacing--30);
	padding-right: var(--wp--preset--spacing--30);
}

.namalo-hero .wp-block-cover__inner-container {
	width: 100%;
	max-width: var(--wp--style--global--wide-size, 1200px);
}

.namalo-hero__content {
	max-width: 680px;
	margin-left: 0 !important;
	margin-right: auto !important;
}

.namalo-hero h1,
.namalo-hero p,
.namalo-cta h2,
.namalo-cta p {
	color: var(--wp--preset--color--base);
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.namalo-hero .wp-block-button__link,
.namalo-cta .wp-block-button__link {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary);
	text-shadow: none;
}

.namalo-hero .wp-block-button__link:hover,
.namalo-cta .wp-block-button__link:hover,
.namalo-hero .wp-block-button__link:focus,
.namalo-cta .wp-block-button__link:focus {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary-dark);
}

.namalo-cta__content {
	text-align: center;
	max-width: 720px;
	margin-left: auto !important;
	margin-right: auto !important;
}

/* ==========================================================================
   5. Introduction columns, impact statistics
   ========================================================================== */

.namalo-intro-card {
	height: 100%;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--surface);
	border-top: 4px solid var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--namalo--radius);
	box-shadow: var(--wp--preset--shadow--soft);
}

.namalo-intro-card .wp-block-image {
	margin-bottom: 0;
}

.namalo-intro-card .wp-block-image img {
	width: 56px;
	height: 56px;
	border-radius: 0;
}

.namalo-intro-card .wp-block-buttons .wp-block-button__link {
	padding: 0;
	background: transparent;
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
	font-weight: 600;
	border-radius: 2px;
}

.namalo-intro-card .wp-block-buttons .wp-block-button__link:hover {
	color: var(--wp--preset--color--primary-dark);
	text-decoration-thickness: 2px;
}

.namalo-stat {
	text-align: center;
}

.namalo-stat__figure {
	margin: 0;
	font-weight: 800;
	line-height: 1;
	color: var(--wp--preset--color--base);
	font-variant-numeric: tabular-nums;
}

.namalo-stat__label {
	margin-top: 0.5rem;
	font-size: var(--wp--preset--font-size--medium);
	color: var(--wp--preset--color--base);
}

.namalo-stat .wp-block-image {
	display: flex;
	justify-content: center;
	margin-bottom: 0.5rem;
}

.namalo-stat .wp-block-image img {
	width: 44px;
	height: 44px;
	border-radius: 0;
	filter: brightness(0) invert(1);
}

/* ==========================================================================
   6. Programme cards: Query Loop fallback (when Namalo Blocks is not active)
   ========================================================================== */

.namalo-programmes-fallback .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--40);
	list-style: none;
	margin: 0;
	padding: 0;
}

.namalo-programmes-fallback .wp-block-post-template > li {
	margin: 0;
	background: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--namalo--radius);
	overflow: hidden;
}

.namalo-programmes-fallback .wp-block-post-featured-image {
	margin: 0;
}

.namalo-programmes-fallback .wp-block-post-featured-image img {
	width: 100%;
	height: 220px;
	object-fit: cover;
	border-radius: 0;
}

.namalo-programmes-fallback .namalo-card-body {
	padding: var(--wp--preset--spacing--40);
}

@media (max-width: 700px) {
	.namalo-programmes-fallback .wp-block-post-template {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ==========================================================================
   7. News cards
   ========================================================================== */

.namalo-news .wp-block-post-template {
	gap: var(--wp--preset--spacing--40);
}

.namalo-news-card {
	height: 100%;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--namalo--radius);
	overflow: hidden;
	box-shadow: var(--wp--preset--shadow--soft);
	display: flex;
	flex-direction: column;
}

.namalo-news-card .wp-block-post-featured-image {
	margin: 0;
}

.namalo-news-card .wp-block-post-featured-image img {
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: 0;
}

.namalo-news-card__body {
	padding: var(--wp--preset--spacing--40);
	flex: 1 1 auto;
}

.namalo-news-card .wp-block-post-excerpt__more-link {
	display: inline-block;
	margin-top: 0.5rem;
	font-weight: 600;
}

/* ==========================================================================
   8. Partner logo strip (accessible marquee)
   ========================================================================== */

/* Default / no-JS / reduced-motion: a static, wrapping row of logos. */
.namalo-partners__strip {
	position: relative;
	overflow: hidden;
}

.namalo-partners__track {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
	margin: 0;
	padding: 0;
	list-style: none;
}

.namalo-partners__track > .wp-block-image,
.namalo-partners__track > li {
	margin: 0;
	flex: 0 0 auto;
}

/*
 * Logos. Scoped to the strip (not to one specific child structure) so they keep
 * working whether a logo is linked or not, and whether the editor left the logos
 * in the original row group, wrapped them, or turned them into a Gallery.
 * The size rules use !important only to beat Gallery block defaults.
 */
.namalo-partners__strip figure img,
.namalo-partners__strip .wp-block-image img {
	display: block;
	width: auto !important;
	max-width: 180px;
	height: 64px !important;
	object-fit: contain !important;
	border-radius: 0;
	filter: grayscale(1);
	opacity: 0.85;
	transition: filter 0.2s ease, opacity 0.2s ease;
}

.namalo-partners__strip a {
	display: block;
	padding: 0.25rem;
}

/* Full colour on hover or keyboard focus: on the logo, its link, or its wrapper (linked or not). */
.namalo-partners__strip img:hover,
.namalo-partners__strip a:hover img,
.namalo-partners__strip a:focus img,
.namalo-partners__strip a:focus-visible img,
.namalo-partners__strip figure:hover img,
.namalo-partners__strip figure:focus-within img,
.namalo-partners__track > *:hover img,
.namalo-partners__track > *:focus-within img {
	filter: none;
	opacity: 1;
}

/* Animated mode: only enabled by marquee.js and only when motion is allowed. */
.namalo-partners__strip.is-marquee .namalo-partners__track {
	display: flex;
	flex-wrap: nowrap;
	justify-content: flex-start;
	width: max-content;
	gap: 0;
	animation: namalo-marquee var(--namalo-marquee-duration, 40s) linear infinite;
}

.namalo-partners__strip.is-marquee .namalo-partners__track > * {
	flex: 0 0 auto !important;
	width: auto !important;
	margin: 0 !important;
	padding: 0 calc(var(--wp--preset--spacing--50) / 2);
}

.namalo-partners__strip.is-marquee:hover .namalo-partners__track,
.namalo-partners__strip.is-marquee:focus-within .namalo-partners__track,
.namalo-partners__strip.is-marquee.is-paused .namalo-partners__track {
	animation-play-state: paused;
}

@keyframes namalo-marquee {
	from {
		transform: translateX(0);
	}

	to {
		transform: translateX(-50%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.namalo-partners__strip.is-marquee .namalo-partners__track {
		animation: none;
		flex-wrap: wrap;
		width: auto;
		justify-content: center;
	}
}

.namalo-marquee-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin: 1rem auto 0;
	padding: 0.4rem 0.9rem;
	min-height: 44px;
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--base);
	border: 2px solid var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--namalo--radius-small);
	cursor: pointer;
}

.namalo-marquee-toggle:hover {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
}

/* ==========================================================================
   9. Inner pages, archives, posts
   ========================================================================== */

.namalo-page-banner {
	background: var(--wp--preset--gradient--burgundy-fade);
	color: var(--wp--preset--color--base);
}

.namalo-page-banner :where(h1, h2, p, a, .wp-block-post-title, .wp-block-post-date, .wp-block-post-terms) {
	color: var(--wp--preset--color--base);
}

.namalo-page-banner .wp-block-post-title a {
	text-decoration: none;
}

.namalo-breadcrumb-note {
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-post-featured-image img {
	border-radius: var(--wp--custom--namalo--radius);
}

.namalo-archive-card {
	border-bottom: 1px solid var(--wp--preset--color--surface);
	padding-bottom: var(--wp--preset--spacing--40);
}

.wp-block-query-pagination {
	gap: 0.75rem;
	margin-top: var(--wp--preset--spacing--50);
}

.wp-block-query-pagination .page-numbers,
.wp-block-query-pagination a {
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 0.75rem;
	border: 1px solid var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--namalo--radius-small);
	text-decoration: none;
}

.wp-block-query-pagination .page-numbers.current {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--primary);
}

.namalo-programme-aside {
	background: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--namalo--radius);
	border-left: 4px solid var(--wp--preset--color--primary);
}

.namalo-404 {
	text-align: center;
}

.namalo-404__code {
	font-size: clamp(5rem, 18vw, 10rem);
	font-weight: 800;
	line-height: 1;
	color: var(--wp--preset--color--primary);
	margin: 0;
}

/* Forms (comments, search, contact plugins) */
:where(input[type="text"], input[type="email"], input[type="url"], input[type="tel"], input[type="search"], input[type="password"], input[type="number"], textarea, select) {
	width: 100%;
	max-width: 100%;
	min-height: 44px;
	padding: 0.6rem 0.8rem;
	font: inherit;
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--secondary);
	border-radius: var(--wp--custom--namalo--radius-small);
}

label {
	font-weight: 600;
}

.wp-block-search__inside-wrapper {
	gap: 0.5rem;
}

.wp-block-search__input {
	width: auto;
	flex: 1 1 12rem;
}

/* Tables */
.wp-block-table th,
.wp-block-table td {
	padding: 0.65rem 0.8rem;
}

.wp-block-table thead {
	border-bottom: 3px solid var(--wp--preset--color--primary);
}

.wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background: var(--wp--preset--color--surface);
}

/* ==========================================================================
   10. Footer
   ========================================================================== */

.namalo-footer a {
	color: var(--wp--preset--color--base);
}

.namalo-footer a:hover,
.namalo-footer a:focus {
	color: var(--wp--preset--color--surface);
	text-decoration-thickness: 2px;
}

.namalo-footer h2,
.namalo-footer h3,
.namalo-footer h4 {
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--large);
}

.namalo-footer .wp-block-navigation {
	flex-direction: column;
	align-items: flex-start;
	font-weight: 400;
}

.namalo-footer .wp-block-navigation .wp-block-navigation__container {
	flex-direction: column;
	align-items: flex-start;
	gap: 0.35rem;
}

.namalo-footer .wp-block-navigation a {
	color: var(--wp--preset--color--base);
	text-decoration: underline;
}

.namalo-footer__bottom {
	border-top: 1px solid rgba(255, 255, 255, 0.25);
	font-size: var(--wp--preset--font-size--small);
}

.namalo-footer .wp-block-social-links {
	gap: 0.6rem;
}

/* ==========================================================================
   11. Responsive refinements
   ========================================================================== */

@media (max-width: 781px) {
	.namalo-topbar__inner {
		justify-content: center !important;
		text-align: center;
	}

	.namalo-header__inner {
		gap: 0.75rem;
	}

	.namalo-header .wp-block-site-logo img {
		max-height: 48px;
	}

	.namalo-hero.wp-block-cover {
		min-height: 440px !important;
	}

	.namalo-hero__content {
		margin-left: auto !important;
	}
}

@media (min-width: 782px) and (max-width: 1023px) {
	.namalo-stats .wp-block-columns {
		flex-wrap: wrap !important;
	}

	.namalo-stats .wp-block-columns > .wp-block-column {
		flex-basis: calc(50% - 1rem) !important;
	}
}

@media print {
	.namalo-topbar,
	.namalo-header,
	.namalo-footer,
	.namalo-marquee-toggle {
		display: none !important;
	}
}

/* ==========================================================================
   12. Layout helpers added after first review
   ========================================================================== */

/* Sections sit flush against each other: no block-gap between homepage sections. */
.namalo-main > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

/* Columns that should wrap to two-up on tablets instead of squeezing to four-up. */
@media (min-width: 782px) and (max-width: 1023px) {
	.namalo-wrap-tablet {
		flex-wrap: wrap !important;
	}

	.namalo-wrap-tablet > .wp-block-column {
		flex-basis: calc(50% - 1rem) !important;
		flex-grow: 1;
	}
}

/* Footer logo pill only appears when a logo has been uploaded. */
.namalo-footer__logo:not(:has(img)) {
	display: none;
}

.namalo-footer__logo {
	display: inline-block;
}

.namalo-footer__logo img {
	max-height: 56px;
	width: auto;
	border-radius: 0;
}

/* Programme / contact templates: content column and aside. */
.namalo-programme-columns {
	gap: var(--wp--preset--spacing--50);
}

.namalo-programme-columns > .wp-block-column:first-child {
	flex-basis: 66%;
}

.namalo-programme-columns > .wp-block-column:last-child {
	flex-basis: 34%;
}

/* Block styles registered by the theme. */
.is-style-namalo-card {
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--namalo--radius);
	box-shadow: var(--wp--preset--shadow--soft);
}

.wp-block-button.is-style-namalo-link .wp-block-button__link {
	padding: 0;
	background: transparent;
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
}

/* Fallback image shown when a post/page has no featured image. */
.namalo-post-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 10;
	margin: 0;
	background: var(--wp--preset--color--primary-tint);
}

.namalo-post-icon svg {
	width: 56px;
	height: 56px;
}

/* Pause / play control for the partner strip is centred under it. */
.namalo-marquee-toggle {
	display: flex;
	width: fit-content;
}

/* Higher specificity so banner text stays white over the gradient. */
.namalo-page-banner :is(h1, h2, p, a, .wp-block-post-title, .wp-block-post-date, .wp-block-post-terms, .wp-block-post-author-name) {
	color: var(--wp--preset--color--base);
}

.namalo-page-banner .wp-block-post-terms a,
.namalo-page-banner .wp-block-post-date a {
	text-decoration: none;
}

.namalo-marquee-toggle[hidden] {
	display: none;
}

/* ==========================================================================
   13. Top bar: member controls (Member Login / My Account / Logout)
   ========================================================================== */

.namalo-topbar__right {
	margin-left: auto;
	gap: 0.75rem 1rem;
}

.namalo-topbar .namalo-auth {
	gap: 0.5rem;
	flex-wrap: nowrap;
}

.namalo-topbar .namalo-auth .wp-block-button__link {
	min-height: 32px;
	padding: 0.2em 0.9em;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1.5;
	text-decoration: none;
	white-space: nowrap;
	background: transparent;
	color: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--base);
	border-radius: var(--wp--custom--namalo--radius-small);
}

.namalo-topbar .namalo-auth .wp-block-button__link:hover,
.namalo-topbar .namalo-auth .wp-block-button__link:focus {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--secondary);
	text-decoration: none;
}

/* ==========================================================================
   14. Search icon and overlay
   ========================================================================== */

.namalo-header .namalo-search-toggle-wrap .wp-block-button__link,
.namalo-header .namalo-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-width: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--wp--preset--color--primary);
	font-size: 0;
	line-height: 1;
	cursor: pointer;
}

.namalo-header .namalo-search-toggle-wrap .wp-block-button__link:hover,
.namalo-header .namalo-search-toggle:hover {
	background: var(--wp--preset--color--primary-tint);
	color: var(--wp--preset--color--primary-dark);
}

.namalo-header__search {
	margin-left: -0.25rem;
}

.namalo-search[hidden] {
	display: none !important;
}

.namalo-search {
	position: fixed;
	inset: 0;
	z-index: 100002; /* above the mobile menu (100000) and the admin bar (99999) */
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: min(14vh, 8rem) 1rem 1rem;
	background: rgba(41, 41, 41, 0.72);
	overflow-y: auto;
}

.namalo-search__panel {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 640px;
	max-height: calc(100vh - 2rem);
	max-height: calc(100dvh - 2rem);
	overflow-y: auto;
	padding: var(--wp--preset--spacing--40);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	border-top: 4px solid var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--namalo--radius);
	box-shadow: var(--wp--preset--shadow--raised);
}

.namalo-search__title {
	margin: 0 3rem 0.75rem 0;
	font-size: var(--wp--preset--font-size--large);
	color: var(--wp--preset--color--primary);
}

.namalo-search__form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.namalo-search__input {
	flex: 1 1 14rem;
	min-width: 0;
	min-height: 48px;
	padding: 0.5em 0.9em;
	font: inherit;
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--base);
	border: 2px solid var(--wp--preset--color--secondary);
	border-radius: var(--wp--custom--namalo--radius-small);
}

.namalo-search__submit {
	min-height: 48px;
	padding: 0.5em 1.4em;
	cursor: pointer;
}

.namalo-search__close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--wp--preset--color--secondary);
	cursor: pointer;
}

.namalo-search__close:hover {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary);
}

html.namalo-search-open {
	overflow: hidden;
}

html.namalo-search-open .namalo-back-to-top {
	display: none;
}

@media (max-width: 599px) {
	.namalo-search {
		padding-top: 1rem;
	}

	.namalo-search__submit {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.namalo-search:not([hidden]) .namalo-search__panel {
		animation: namalo-search-in 160ms ease-out;
	}

	@keyframes namalo-search-in {
		from {
			opacity: 0;
			transform: translateY(-8px);
		}

		to {
			opacity: 1;
			transform: none;
		}
	}
}

/* ==========================================================================
   15. Back-to-top button
   ========================================================================== */

/* Move it up if another floating widget (cookie banner, chat) sits in the corner:
   :root { --namalo-back-to-top-bottom: 5rem; } in Appearance > Editor > Styles > Additional CSS. */
.namalo-back-to-top {
	position: fixed;
	right: max(1rem, env(safe-area-inset-right));
	bottom: calc(var(--namalo-back-to-top-bottom, 1.25rem) + env(safe-area-inset-bottom));
	z-index: 90;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 2px solid var(--wp--preset--color--base);
	border-radius: 50%;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	box-shadow: var(--wp--preset--shadow--raised);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
}

.namalo-back-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.namalo-back-to-top:hover {
	background: var(--wp--preset--color--primary-dark);
}

.namalo-back-to-top:focus-visible {
	outline: 3px solid var(--wp--preset--color--primary-dark);
	outline-offset: 3px;
	box-shadow: 0 0 0 6px var(--wp--preset--color--base);
}

@media (prefers-reduced-motion: no-preference) {
	.namalo-back-to-top {
		transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms, background-color 150ms ease;
	}

	.namalo-back-to-top.is-visible {
		transition-delay: 0s;
	}
}

@media print {
	.namalo-back-to-top,
	.namalo-search {
		display: none !important;
	}
}

/* ==========================================================================
   16. Hero layout options (chosen in the block sidebar: Hero layout)
   No class = the original look: text box left, text left-aligned, vertically centred.
   ========================================================================== */

/* Text alignment: heading, text and buttons together. Per-element alignment set on an
   individual block still wins. */
.namalo-hero--text-left .namalo-hero__content {
	text-align: left;
}

.namalo-hero--text-center .namalo-hero__content {
	text-align: center;
}

.namalo-hero--text-right .namalo-hero__content {
	text-align: right;
}

.namalo-hero--text-left .namalo-hero__content .wp-block-buttons:not([class*="is-content-justification"]) {
	justify-content: flex-start;
}

.namalo-hero--text-center .namalo-hero__content .wp-block-buttons:not([class*="is-content-justification"]) {
	justify-content: center;
}

.namalo-hero--text-right .namalo-hero__content .wp-block-buttons:not([class*="is-content-justification"]) {
	justify-content: flex-end;
}

/* Position of the text box. */
.namalo-hero--pos-left .namalo-hero__content {
	margin-left: 0 !important;
	margin-right: auto !important;
}

.namalo-hero--pos-center .namalo-hero__content {
	margin-left: auto !important;
	margin-right: auto !important;
}

.namalo-hero--pos-right .namalo-hero__content {
	margin-left: auto !important;
	margin-right: 0 !important;
}

/* Vertical position. */
.wp-block-cover.namalo-hero.namalo-hero--v-top {
	align-items: flex-start;
}

.wp-block-cover.namalo-hero.namalo-hero--v-middle {
	align-items: center;
}

.wp-block-cover.namalo-hero.namalo-hero--v-bottom {
	align-items: flex-end;
}

.wp-block-cover.namalo-hero.namalo-hero--v-top,
.wp-block-cover.namalo-hero.namalo-hero--v-bottom {
	padding-top: var(--wp--preset--spacing--50);
	padding-bottom: var(--wp--preset--spacing--50);
}

/* Phones: the text box always takes the full width, so Left / Centre / Right position only
   matters from tablet width up. Text alignment can be set separately for phones. */
@media (max-width: 781px) {
	.namalo-hero .namalo-hero__content {
		max-width: none;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	.namalo-hero--m-left .namalo-hero__content {
		text-align: left;
	}

	.namalo-hero--m-center .namalo-hero__content {
		text-align: center;
	}

	.namalo-hero--m-left .namalo-hero__content .wp-block-buttons:not([class*="is-content-justification"]) {
		justify-content: flex-start;
	}

	.namalo-hero--m-center .namalo-hero__content .wp-block-buttons:not([class*="is-content-justification"]) {
		justify-content: center;
	}
}
