/*
Theme Name: Moat Church
Description: Custom block theme for Moat United Reformed Church, East Grinstead.
Version: 1.0.0
Requires at least: 6.6
Requires PHP: 8.1
Text Domain: moat
License: GPL-2.0-or-later
*/

/* ---------- Base ---------- */

html { scroll-padding-top: 1rem; }

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

:where(p, li) { max-width: 68ch; }

::selection { background: var(--wp--preset--color--blue); color: var(--wp--preset--color--limewash); }

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

:focus-visible {
	outline: 3px solid var(--wp--preset--color--red);
	outline-offset: 3px;
	border-radius: 2px;
}

.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--limewash);
	color: var(--wp--preset--color--blue);
	font-weight: 700;
}

/* Header, main and footer sit flush; sections handle their own spacing. */
.wp-site-blocks > * + * { margin-block-start: 0; }

/* Breathing room before section headings inside page text. */
.wp-block-post-content > :where(h2, .wp-block-columns, .wp-block-gallery) { margin-block-start: var(--wp--preset--spacing--50); }
.wp-block-post-content :where(.wp-block-column) > h2:first-child { margin-block-start: 0; }

/* ---------- Header ---------- */

.moat-header {
	border-bottom: 1px solid var(--wp--preset--color--stone);
}

.moat-header .wp-block-site-tagline { margin-top: 0.35rem; }

.moat-header .wp-block-navigation a { text-decoration: none; }
.moat-header .wp-block-navigation .wp-block-navigation-item__content { padding-block: 0.4rem; border-bottom: 2px solid transparent; }
.moat-header .wp-block-navigation .wp-block-navigation-item__content:hover,
.moat-header .wp-block-navigation .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--blue);
	border-bottom-color: var(--wp--preset--color--red);
}

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

/* ---------- Arch image style (the signature) ----------
   A pointed gothic arch, echoing the apse and the church windows.
   Available to editors as the "Arch" style on Image blocks. */

.wp-block-image.is-style-arch img {
	aspect-ratio: 4 / 5;
	width: 100%;
	object-fit: cover;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 125' preserveAspectRatio='none'%3E%3Cpath d='M0 125V52C0 26 28 10 50 0C72 10 100 26 100 52V125Z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 125' preserveAspectRatio='none'%3E%3Cpath d='M0 125V52C0 26 28 10 50 0C72 10 100 26 100 52V125Z'/%3E%3C/svg%3E");
	-webkit-mask-size: 100% 100%;
	mask-size: 100% 100%;
	border-radius: 0;
}

/* ---------- Home: welcome band ---------- */

.moat-welcome {
	overflow: hidden;
}

.moat-welcome .moat-welcome__line {
	font-family: var(--wp--preset--font-family--display);
	line-height: 1.08;
	letter-spacing: -0.01em;
	max-width: 14ch;
	text-wrap: balance;
}

.moat-welcome .moat-welcome__facts {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.45;
	max-width: 38ch;
}

.moat-welcome .moat-welcome__facts strong { color: #fff; }

.moat-welcome .wp-block-button__link {
	background: var(--wp--preset--color--limewash);
	color: var(--wp--preset--color--blue);
}
.moat-welcome .wp-block-button__link:hover {
	background: #fff;
	color: var(--wp--preset--color--red);
}
.moat-welcome .wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--limewash);
	border: 2px solid currentColor;
}
.moat-welcome .wp-block-button.is-style-outline .wp-block-button__link:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.08);
}

.moat-welcome a:not(.wp-block-button__link) { color: inherit; }

/* The arch stands on the bottom edge of the blue band, like a doorway. */
.moat-welcome { padding-bottom: 0 !important; }
.moat-welcome .wp-block-columns > .wp-block-column:first-child { padding-bottom: var(--wp--preset--spacing--50); }
.moat-welcome .wp-block-columns > .wp-block-column:last-child { align-self: flex-end; }
.moat-welcome .moat-welcome__arch { margin: 0; }
.moat-welcome .moat-welcome__arch img { display: block; }

@media (min-width: 782px) {
	.moat-welcome .wp-block-columns > .wp-block-column:first-child { padding-bottom: var(--wp--preset--spacing--60); }
}

@media (max-width: 781px) {
	.moat-welcome .moat-welcome__arch { max-width: 20rem; margin-inline: auto; }
}

/* Photos beside text on the home page share one landscape shape. */
.home .alignfull .wp-block-columns .wp-block-image:not(.is-style-arch) img {
	aspect-ratio: 4 / 3;
	width: 100%;
	object-fit: cover;
	object-position: 50% 35%;
}

/* ---------- Sunday panel & event list ---------- */

.moat-next-sunday {
	border-left: 4px solid var(--wp--preset--color--red);
	padding: 0.25rem 0 0.25rem 1.25rem;
}
.moat-next-sunday__date {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--x-large);
	color: var(--wp--preset--color--blue);
	line-height: 1.15;
	margin: 0;
}
.moat-next-sunday__note { margin: 0.5rem 0 0; color: var(--wp--preset--color--ink-soft); }

.moat-events { list-style: none; margin: 0; padding: 0; }
.moat-events li { max-width: none; }
.moat-event {
	display: grid;
	grid-template-columns: 4.5rem 1fr;
	gap: 1.25rem;
	align-items: start;
	padding-block: 1.1rem;
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 15%, transparent);
}
.moat-event:last-child { border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 15%, transparent); }

.moat-event__date {
	text-align: center;
	line-height: 1;
	color: var(--wp--preset--color--blue);
}
.moat-event__day { display: block; font-size: 0.875rem; font-weight: 700; color: var(--wp--preset--color--red); }
.moat-event__num { display: block; font-family: var(--wp--preset--font-family--display); font-size: 2.25rem; margin-block: 0.15rem; }
.moat-event__month { display: block; font-size: 0.875rem; }

.moat-event__title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.25;
	margin: 0 0 0.2rem;
}
.moat-event__title a { text-decoration: none; }
.moat-event__title a:hover { text-decoration: underline; }
.moat-event__meta { margin: 0; color: var(--wp--preset--color--ink-soft); }
.moat-event__summary { margin: 0.35rem 0 0; }

.moat-events-empty { color: var(--wp--preset--color--ink-soft); }

/* ---------- Contact form ---------- */

.moat-form { display: grid; gap: 1.1rem; max-width: 36rem; }
.moat-form label { display: block; font-weight: 700; margin-bottom: 0.3rem; }
.moat-form .moat-form__hint { font-weight: 400; color: var(--wp--preset--color--ink-soft); }
.moat-form input[type="text"],
.moat-form input[type="email"],
.moat-form input[type="tel"],
.moat-form select,
.moat-form textarea {
	width: 100%;
	box-sizing: border-box;
	font: inherit;
	color: var(--wp--preset--color--ink);
	background: #fff;
	border: 2px solid color-mix(in srgb, var(--wp--preset--color--ink) 30%, transparent);
	border-radius: 6px;
	padding: 0.65rem 0.8rem;
}
.moat-form textarea { min-height: 10rem; resize: vertical; }
.moat-form input:focus-visible, .moat-form select:focus-visible, .moat-form textarea:focus-visible {
	border-color: var(--wp--preset--color--blue);
	outline: 3px solid color-mix(in srgb, var(--wp--preset--color--blue) 35%, transparent);
	outline-offset: 0;
}
.moat-form button {
	justify-self: start;
	font: inherit;
	font-weight: 700;
	background: var(--wp--preset--color--blue);
	color: var(--wp--preset--color--limewash);
	border: 0;
	border-radius: 999px;
	padding: 0.75em 1.6em;
	cursor: pointer;
}
.moat-form button:hover { background: var(--wp--preset--color--blue-deep); }
.moat-form__trap { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.moat-notice {
	padding: 1rem 1.25rem;
	border-radius: 6px;
	border-left: 4px solid;
	margin-bottom: 1.5rem;
	max-width: 36rem;
}
.moat-notice--ok { background: #E7F1EA; border-color: #2E6B3F; }
.moat-notice--error { background: #FBEAE8; border-color: var(--wp--preset--color--red); }
.moat-notice p { margin: 0; }
.moat-notice ul { margin: 0.5rem 0 0; }

/* ---------- People list (contact page) ---------- */

.moat-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.5rem; }
.moat-people p { margin: 0; }

/* ---------- Footer ---------- */

.moat-footer a { color: inherit; }
.moat-footer a:hover { color: #fff; }
.moat-footer .wp-block-heading { color: #fff; }
.moat-footer__welcome {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.3;
	max-width: 22ch;
}
.moat-footer__urc img { filter: invert(1) brightness(2); opacity: 0.9; }
.moat-footer__small { opacity: 0.85; }

/* ---------- Galleries & images ---------- */

.wp-block-gallery.has-nested-images figure.wp-block-image img { border-radius: 4px; }
.wp-block-image:not(.is-style-arch) img { border-radius: 4px; }
.wp-block-image.is-style-historic img { filter: sepia(0.25); }

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
	.moat-welcome .moat-welcome__arch img {
		animation: moat-arch-in 900ms cubic-bezier(.2,.7,.2,1) both;
	}
	@keyframes moat-arch-in {
		from { opacity: 0; transform: translateY(18px); }
		to { opacity: 1; transform: none; }
	}
}

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

@media print {
	.moat-header .wp-block-navigation, .moat-footer, .wp-block-buttons { display: none !important; }
	body { background: #fff; }
}
