/*
Theme Name:   Pella Nazarene
Description:  Child theme of Twenty Twenty-Five for pellanazarene.org.
Template:     twentytwentyfive
Version:      0.4.0
Requires PHP: 8.1
Text Domain:  pella-nazarene
*/

/* Most styling lives in theme.json. Keep this file small. */

/* ---- Home page (FE-5, after the approved homepage mockup) ---- */

/* Full-width bands sit flush against each other (no white strip between the hero and the bar under it). */
.wp-block-post-content > .alignfull + .alignfull {
	margin-block-start: 0;
}

/* Hero: the photo fills the navy band behind the words. A navy fade from the left keeps the white text readable
   on any picture (navy at 88% or more behind the text gives 7.7:1 with white even over a white patch of photo),
   then falls off quickly past the text so the photo shows on the right. The photo is still the page's first, preloaded image. */
.pn-hero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding-top: clamp(4rem, 9vw, 7.5rem);
	padding-bottom: clamp(4rem, 9vw, 7.5rem);
}

.pn-hero > figure.pn-photo--hero {
	position: absolute;
	inset: 0;
	z-index: -2;
	margin: 0;
	max-width: none;
}

.pn-hero > figure.pn-photo--hero img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 62% 40%;
	border-radius: 0;
}

.pn-hero::before {
	/* Where the text block ends: its left edge (the page padding, or the centered 1200px column on wide
	   screens) plus its 36rem width. The fade holds dark navy to there, then falls off within 12rem
	   (or by the right edge, on screens too narrow for that). */
	--pn-hero-text-end: calc(max(var(--wp--style--root--padding-left, 1.5rem), (100% - var(--wp--style--global--wide-size, 1200px)) / 2) + 36rem);
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(90deg,
		color-mix(in srgb, var(--wp--preset--color--accent-3) 96%, transparent) 0%,
		color-mix(in srgb, var(--wp--preset--color--accent-3) 88%, transparent) var(--pn-hero-text-end),
		color-mix(in srgb, var(--wp--preset--color--accent-3) 25%, transparent) min(calc(var(--pn-hero-text-end) + 12rem), 100%),
		color-mix(in srgb, var(--wp--preset--color--accent-3) 15%, transparent) 100%);
}

@media (max-width: 781px) {
	.pn-hero::before {
		background: color-mix(in srgb, var(--wp--preset--color--accent-3) 88%, transparent);
	}
}

.pn-hero__content > * {
	max-width: 36rem;
}

.pn-hero .pn-hero__title {
	margin: 0.25rem 0 1rem;
	color: var(--wp--preset--color--base);
	font-size: clamp(2.5rem, 6vw, 4rem);
	line-height: 1.05;
	letter-spacing: -0.02em;
}

.pn-hero .wp-block-buttons {
	margin-top: 2rem;
}

/* On navy, the navy focus ring would vanish: use white. */
.pn-hero a:focus-visible,
.pn-page-header a:focus-visible,
.pn-infobar a:focus-visible {
	outline: 3px solid var(--wp--preset--color--base);
	outline-offset: 3px;
}

/* Colored buttons keep a visible hover. The color classes WordPress writes carry !important, so these must too. */
.wp-block-button__link.has-rust-background-color:hover {
	background-color: var(--wp--preset--color--rust-dark) !important;
}

.wp-block-button__link.has-base-background-color:hover {
	background-color: var(--wp--preset--color--accent-2) !important;
	color: var(--wp--preset--color--primary-dark) !important;
}

/* A heading sits right under its eyebrow label (the theme otherwise adds space above every later heading). */
p.is-style-eyebrow + h2.wp-block-heading {
	margin-block-start: 0.25rem;
}

/* The strip under the hero: Sunday times, address, directions. */
.pn-infobar p {
	margin: 0;
}

.pn-infobar .wp-block-group {
	column-gap: 2.5rem;
	row-gap: 0.25rem;
}

.pn-infobar a {
	color: var(--wp--preset--color--base);
}

/* "Read more" links: bold rust, with the arrow written in the text. */
.pn-more a {
	color: var(--wp--preset--color--rust);
	font-weight: 800;
	text-decoration: none;
}

.pn-more a:hover {
	color: var(--wp--preset--color--rust-dark);
	text-decoration: underline;
}

.pn-photo--half img {
	border-radius: 12px;
}

/* "Find your place": three white cards, photo on top. */
.pn-cards {
	margin-top: 2rem;
}

.pn-cards .pn-card {
	padding: 0 0 1.75rem;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 1px 3px color-mix(in srgb, var(--wp--preset--color--accent-3) 12%, transparent);
}

.pn-card > figure {
	margin: 0 0 1.5rem;
}

.pn-card > figure img {
	display: block;
	width: 100%;
	border-radius: 0;
}

.pn-card > :not(figure) {
	padding-left: 1.5rem;
	padding-right: 1.5rem;
}

.pn-card > h3.wp-block-heading {
	margin-top: 0;
}

/* "Latest message": the video beside its title and buttons. */
.pn-latest-sermon--feature {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	gap: clamp(1.5rem, 4vw, 3.5rem);
	align-items: center;
}

/* A sermon with no video: the words use the whole width instead of leaving the video's column empty. */
.pn-latest-sermon__text:only-child {
	grid-column: 1 / -1;
}

.pn-latest-sermon--feature .pn-video {
	border-radius: 12px;
}

.pn-latest-sermon__text h2 {
	margin: 0 0 0.75rem;
}

.pn-latest-sermon__byline {
	color: var(--wp--preset--color--accent-4);
}

.pn-latest-sermon__text .wp-block-buttons {
	margin-top: 1.5rem;
}

@media (max-width: 781px) {
	.pn-latest-sermon--feature {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* "What's happening": the weekly events as a white list. A real table (when, what, where) so staff can edit it;
   the header row is there for screen readers and hidden on screen. */
.pn-week table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	border-radius: 12px;
	overflow: hidden;
	background: var(--wp--preset--color--base);
}

.pn-week thead {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.pn-week td {
	padding: 1.1rem 1.5rem;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--accent-2);
	vertical-align: middle;
}

.pn-week tr:last-child td {
	border-bottom: 0;
}

.pn-week td:first-child {
	width: 14rem;
	color: var(--wp--preset--color--rust);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 800;
}

.pn-week td:nth-child(2) {
	font-weight: 800;
}

.pn-week td:last-child {
	width: 14rem;
	color: var(--wp--preset--color--accent-4);
	font-size: var(--wp--preset--font-size--small);
}

@media (max-width: 781px) {
	.pn-week tr {
		display: block;
		padding: 1rem 1.25rem;
		border-bottom: 1px solid var(--wp--preset--color--accent-2);
	}

	.pn-week tr:last-child {
		border-bottom: 0;
	}

	.pn-week td,
	.pn-week td:first-child,
	.pn-week td:last-child {
		display: block;
		width: auto;
		padding: 0;
		border: 0;
	}
}

/* ---- Inner pages (FE-6): the same look as the home page ---- */

/* Every page opens with a navy header: eyebrow, the page's h1, one line, sometimes buttons. */
.pn-page-header {
	padding-top: clamp(3rem, 7vw, 5.5rem);
	padding-bottom: clamp(3rem, 7vw, 5.5rem);
}

.pn-page-header__content > * {
	max-width: 44rem;
}

.pn-page-header .pn-page-header__title {
	margin: 0.25rem 0 1rem;
	color: var(--wp--preset--color--base);
	font-size: clamp(2.25rem, 5vw, 3.5rem);
	line-height: 1.08;
	letter-spacing: -0.02em;
}

.pn-page-header .wp-block-buttons {
	margin-top: 1.75rem;
}

/* The blog and sermon lists start right under their header. */
.pn-page-header + .wp-block-query {
	margin-top: var(--wp--preset--spacing--60);
}

/* Blog list: a thumbnail beside each post, stacked on phones. The text keeps a readable minimum
   width, so on a narrow screen it wraps under the image instead of squeezing beside it. */
.pn-post-list > li + li {
	margin-top: var(--wp--preset--spacing--50);
}

.pn-post-card {
	gap: var(--wp--preset--spacing--40);
}

.pn-post-card__image img {
	border-radius: 0.5rem;
}

.pn-post-card__body {
	flex: 1 1 18rem;
	min-width: min(100%, 18rem);
}

.pn-post-card__body > .wp-block-post-title {
	margin-top: 0;
}

/* Sermon cards: the speaker's photo sits on the bottom-left corner of the artwork, half below it, with the
   title beside it (inc/sermons.php). The badge selector outranks core's featured-image `img` rules
   (`:where(img)` and the wide/full ones), whatever order the stylesheets load in. */
.pn-has-speaker {
	position: relative;
	overflow: visible;
}

.wp-block-post-featured-image.pn-has-speaker > .pn-speaker-badge {
	position: absolute;
	left: 0.875rem;
	bottom: -1.875rem;
	width: 3.75rem;
	height: 3.75rem;
	border: 3px solid var(--wp--preset--color--base);
	border-radius: 50%;
	object-fit: cover;
	background: var(--wp--preset--color--stone);
	box-shadow: 0 2px 8px color-mix(in srgb, var(--wp--preset--color--navy-deep) 35%, transparent);
}

.pn-has-speaker + .wp-block-post-title {
	padding-left: 5.375rem;
}

@media (max-width: 600px) {
	.wp-block-post-featured-image.pn-has-speaker > .pn-speaker-badge {
		width: 3.125rem;
		height: 3.125rem;
		bottom: -1.5625rem;
	}

	.pn-has-speaker + .wp-block-post-title {
		padding-left: 4.625rem;
	}
}

/* A page without its own header still shows the template's title, with room above it. */
.pn-page-title {
	margin-top: var(--wp--preset--spacing--60);
}

/* A panel: a rounded block of key facts set on a band (white on stone, stone on white). */
.pn-panel {
	padding: clamp(1.5rem, 3vw, 2.25rem);
	border-radius: 12px;
}

.pn-panel > :first-child {
	margin-top: 0;
}

/* Tiles: a grid of small white boxes (values, beliefs, links), as many across as fit. */
.pn-tiles {
	margin-top: 2rem;
	gap: 1.25rem;
}

.pn-tile {
	padding: 1.5rem 1.75rem;
	border-radius: 12px;
	box-shadow: 0 1px 3px color-mix(in srgb, var(--wp--preset--color--accent-3) 12%, transparent);
}

.pn-tile > :first-child {
	margin-top: 0;
}

.pn-tile > h3.wp-block-heading {
	margin-bottom: 0.5rem;
	font-size: var(--wp--preset--font-size--large);
}

/* A navy band (a statement such as the mission): white headings and text, white links. */
.pn-band-navy h2,
.pn-band-navy h3 {
	color: var(--wp--preset--color--base);
}

.pn-band-navy a {
	color: var(--wp--preset--color--base);
}

.pn-band-navy a:focus-visible {
	outline: 3px solid var(--wp--preset--color--base);
	outline-offset: 3px;
}

/* Staff: one panel per person, photo beside the bio. */
.pn-staff > .pn-panel + .pn-panel {
	margin-top: 1.5rem;
}

.pn-staff .pn-panel .wp-block-columns {
	margin: 0;
}

/* Questions: the Details blocks as one tidy list with a rust plus/minus. */
.pn-faq .wp-block-details {
	margin: 0;
	padding: 1.1rem 0;
	border-bottom: 1px solid var(--wp--preset--color--accent-1);
}

.pn-faq .wp-block-details:first-of-type {
	border-top: 1px solid var(--wp--preset--color--accent-1);
}

.pn-faq .wp-block-details summary {
	position: relative;
	padding-right: 2.5rem;
	color: var(--wp--preset--color--accent-3);
	font-weight: 800;
	list-style: none;
	cursor: pointer;
}

.pn-faq .wp-block-details summary::-webkit-details-marker {
	display: none;
}

.pn-faq .wp-block-details summary::after {
	content: "+";
	position: absolute;
	top: -0.1em;
	right: 0.25rem;
	color: var(--wp--preset--color--rust);
	font-size: 1.5em;
	line-height: 1;
}

.pn-faq .wp-block-details[open] summary::after {
	content: "\2013";
}

.pn-faq .wp-block-details > :not(summary) {
	margin-top: 0.75rem;
}

.pn-service-info {
	font-size: var(--wp--preset--font-size--small);
}

/* Fluent Forms switches off the keyboard focus ring on its fields. Put it back, in the brand navy (well over 3:1
   against the white page), so someone using the Tab key can see which field they are in. */
.frm-fluent-form input:focus-visible,
.frm-fluent-form textarea:focus-visible,
.frm-fluent-form select:focus-visible,
.frm-fluent-form button:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-3) !important;
	outline-offset: 2px;
}

/* Fluent Forms brings its own fonts and colors. Bring them in line with the brand guide: Plus Jakarta Sans on the
   fields and button, and navy (not the plugin's blue) for its accents. A real error message stays red so it still
   looks like an error. */
.fluentform {
	--fluentform-primary: var(--wp--preset--color--accent-3);
}

.frm-fluent-form input,
.frm-fluent-form textarea,
.frm-fluent-form select,
.frm-fluent-form button {
	font-family: inherit;
}

.fluentform .ff-el-input--label.ff-el-is-required.asterisk-right label::after {
	color: var(--wp--preset--color--accent-3);
}
