/*
Theme Name: Grace at Wellington 2025
Theme URI: https://www.gracewellington.org.nz/
Description: Child theme of Twenty Twenty-Five for Grace at Wellington (GPCNZ Wellington congregation). Brand blue/white palette, the church logo, and a deliberately compact header that maximises above-the-fold content. Chrome/nav/core-page layouts only — content and URLs are untouched. Built in preview; activated only on owner approval.
Template: twentytwentyfive
Author: Grace at Wellington website recovery (WM / R308)
Version: 0.1.0
Requires at least: 6.7
Tested up to: 7.0
Requires PHP: 7.4
Text Domain: gracewellington-2025
Tags: church, block-theme, full-site-editing
*/

/*
 * Almost all styling lives in theme.json (Global Styles) — the block-theme way, so the
 * owner can tweak it in Appearance > Editor > Styles without touching code. This file
 * carries only the child-theme header (above) plus the few rules that CSS expresses more
 * naturally than theme.json.
 */

/* Compact header logo: size by HEIGHT only so the logo keeps its aspect ratio
   (fixing both a width and a max-height distorts it). */
.gcw-site-logo {
	margin: 0;
	line-height: 0;
}
.gcw-site-logo a {
	display: inline-block;
	line-height: 0;
}
.wp-block-site-logo img,
.gcw-site-logo img {
	height: 52px;
	width: auto;
	max-width: 100%;
}

/* Blue brand header uses the reversed white logo asset (assets/logo-white.png,
   white-on-transparent). NOTE: the source logo.png has an OPAQUE white background,
   so a CSS invert would render a white box — hence the dedicated reversed asset. */

/* White navigation on the blue bar (belt-and-braces over the block textColor). */
.gcw-header .wp-block-navigation,
.gcw-header .wp-block-navigation a,
.gcw-header .wp-block-navigation .wp-block-navigation-item__label {
	color: #ffffff;
}

/* Desktop dropdown panels (About, Services): navy panel, white links — readable
   against the page, not white-on-white. */
.gcw-header .wp-block-navigation .wp-block-navigation__submenu-container {
	background-color: #20205a;
	border-color: #20205a;
}
.gcw-header .wp-block-navigation .wp-block-navigation__submenu-container a {
	color: #ffffff;
}

/* Content images — including legacy classic-editor <img> that carry fixed pixel
   widths from the old site — must never overflow the column, especially on mobile.
   !important beats those inline widths. */
main img,
.wp-block-post-content img {
	max-width: 100% !important;
	height: auto !important;
}

/* Embeds (Google Maps iframe on the homepage, YouTube, etc.) must not overflow the
   column either — cap width but keep their own height. */
main iframe,
main embed,
main object,
main video,
main .wp-block-embed__wrapper > * {
	max-width: 100% !important;
}

@media (max-width: 600px) {
	/* Floated/aligned legacy images stack full-width rather than spilling off-screen. */
	main .alignleft,
	main .alignright {
		float: none;
		margin-left: 0;
		margin-right: 0;
	}
}

/* Never let the primary navigation wrap into a tall block on desktop. */
@media (min-width: 782px) {
	.wp-block-navigation.gcw-primary-nav {
		flex-wrap: nowrap;
	}
}

/* --- Related resources block (R313) — contextual View on single sermon/devotional pages --- */
.gw-related {
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--line, #e2e5ee);
}
.gw-related__title {
	font-size: var(--wp--preset--font-size--large, 1.5rem);
	margin: 0 0 1.25rem;
}
.gw-related__section {
	margin-bottom: 1.5rem;
}
.gw-related__heading {
	font-size: 1.05rem;
	margin: 0 0 0.5rem;
}
.gw-related__list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.gw-related__list li {
	margin: 0 0 0.35rem;
}
.gw-related__type {
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--wp--preset--color--accent, #3f62c4);
	margin-right: 0.4rem;
}
.gw-related__more {
	margin: 0.5rem 0 0;
	font-size: 0.85rem;
	font-weight: 600;
}
/* Author-by-series list: inline chips, each with a per-author count. */
.gw-related__list--series {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}
.gw-related__list--series li {
	margin: 0;
}
.gw-related__list--series a {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.25rem 0.6rem;
	background: var(--wp--preset--color--accent-tint, #eef1fb);
	border-radius: 999px;
	text-decoration: none;
	font-size: 0.9rem;
}
.gw-related__count {
	font-size: 0.72rem;
	font-weight: 700;
	color: var(--wp--preset--color--base, #fff);
	background: var(--wp--preset--color--accent, #3f62c4);
	border-radius: 999px;
	padding: 0.02rem 0.4rem;
	min-width: 1.2rem;
	text-align: center;
}

/* --- Book index block (R313) — "explore by book", counts advertise library size --- */
.gw-bookindex {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 0.5rem;
}
.gw-bookindex__item a {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem;
	padding: 0.55rem 0.85rem;
	border-radius: 6px;
	text-decoration: none;
	color: var(--wp--preset--color--primary-dark, #20205a);
}
.gw-bookindex__count {
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--wp--preset--color--base, #fff);
	border-radius: 999px;
	padding: 0.05rem 0.5rem;
	min-width: 1.4rem;
	text-align: center;
}
/* Old Testament = brand blue; New Testament = green (the new covenant). */
.gw-bookindex__item--ot a { background: #eaeefc; }
.gw-bookindex__item--ot .gw-bookindex__count { background: #3f62c4; }
.gw-bookindex__item--nt a { background: #e6f2ea; }
.gw-bookindex__item--nt .gw-bookindex__count { background: #2f8f5b; }
.gw-bookindex__empty {
	color: #5a5a6a;
	font-style: italic;
}
/* Legend for the OT/NT colours. */
.gw-bookindex-legend {
	display: flex;
	gap: 1.1rem;
	margin: 0 0 0.75rem;
	font-size: 0.82rem;
	color: #5a5a6a;
}
.gw-bookindex-legend span::before {
	content: "";
	display: inline-block;
	width: 0.7rem;
	height: 0.7rem;
	border-radius: 3px;
	margin-right: 0.35rem;
	vertical-align: -1px;
}
.gw-bookindex-legend__ot::before { background: #3f62c4; }
.gw-bookindex-legend__nt::before { background: #2f8f5b; }

/* --- Series tiles (R313) — the index lead: current/recent series with hero + count --- */
.gw-series-tiles {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 1.25rem;
}
.gw-series-tiles__item a {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	border: 1px solid var(--wp--preset--color--line, #e2e5ee);
	border-radius: 10px;
	overflow: hidden;
	background: var(--wp--preset--color--base, #fff);
	height: 100%;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.gw-series-tiles__item a:hover {
	box-shadow: 0 6px 20px rgba(32, 32, 90, 0.12);
	transform: translateY(-2px);
}
.gw-series-tiles__thumb {
	display: block;
	aspect-ratio: 16 / 9;
	background: var(--wp--preset--color--accent-tint, #eef1fb);
}
.gw-series-tiles__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.gw-series-tiles__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 2.5rem;
	font-weight: 700;
	color: var(--wp--preset--color--base, #fff);
	background: var(--wp--preset--color--primary, #213a8f);
}
.gw-series-tiles__name {
	font-weight: 700;
	color: var(--wp--preset--color--primary-dark, #20205a);
	padding: 0.75rem 0.9rem 0.1rem;
}
.gw-series-tiles__count {
	font-size: 0.82rem;
	color: #5a5a6a;
	padding: 0 0.9rem 0.85rem;
}

/* --- Book archive (R322) — a book's sermons/devotionals ordered by chapter, with facet filters --- */
/* Horizontal filter rows (Chapter, Preacher/author): a scrollable chip row that FILTERS via query args,
   led by an "All" deselect chip. The selected chip is filled (is-active). */
.gw-bookfilter {
	display: flex;
	align-items: baseline;
	gap: 0.75rem;
	margin: 0 0 0.85rem;
}
.gw-bookfilter:last-of-type {
	margin-bottom: 1.75rem;
	padding-bottom: 0.9rem;
	border-bottom: 1px solid var(--wp--preset--color--line, #e2e5ee);
}
.gw-bookfilter__label {
	flex: 0 0 auto;
	min-width: 4.5rem;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #5a5a6a;
	padding-top: 0.3rem;
}
.gw-bookfilter__list {
	list-style: none;
	margin: 0;
	padding: 0.15rem 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}
.gw-bookfilter__list li {
	margin: 0;
	flex: 0 0 auto;
}
.gw-bookfilter__chip {
	display: inline-block;
	text-align: center;
	padding: 0.25rem 0.7rem;
	border-radius: 999px;
	text-decoration: none;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--wp--preset--color--primary-dark, #20205a);
	background: var(--wp--preset--color--accent-tint, #eef1fb);
}
.gw-bookfilter__chip:hover,
.gw-bookfilter__chip:focus {
	background: #dde3f7;
}
.gw-bookfilter__chip.is-active {
	background: var(--wp--preset--color--accent, #3f62c4);
	color: var(--wp--preset--color--base, #fff);
}

.gw-bookarch {
	margin: 0;
}
.gw-bookarch__chapter {
	font-size: 1.25rem;
	color: var(--wp--preset--color--primary-dark, #20205a);
	margin: 2rem 0 0.75rem;
}
.gw-bookarch__chapter:first-child {
	margin-top: 0;
}
.gw-bookarch__list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.gw-bookarch__item {
	margin: 0 0 1.5rem;
}
.gw-bookarch__link {
	font-size: 1.25rem;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.3;
}
.gw-bookarch__type {
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--wp--preset--color--accent, #3f62c4);
	margin-right: 0.4rem;
	vertical-align: 0.1em;
}
.gw-bookarch__meta {
	font-size: 0.85rem;
	color: #5a5a6a;
	margin-top: 0.2rem;
}
.gw-bookarch__excerpt {
	margin: 0.4rem 0 0;
	color: #3a3a46;
}
.gw-bookarch__empty {
	color: #5a5a6a;
	font-style: italic;
}
