/*
Theme Name: NCCS
Theme URI: https://nccs-nanaimo.ca/
Description: Child theme of Twenty Twenty-Five for the Nanaimo Chinese Cultural Society. White + blue only, with Nanaimo photography and subtle Chinese motifs.
Author: NCCS
Template: twentytwentyfive
Version: 1.1.3
Text Domain: nccs
*/

:root {
	--nccs-blue: #1663b8;
	--nccs-navy: #0e2a47;
	--nccs-sky: #e4eef9;
	--nccs-mist: #f1f6fb;
	--nccs-line: #dbe7f5;
	--nccs-ink: #17293d;
	--nccs-muted: #5d7186;
	--nccs-red: #bf3f2b;
	/* Faint cloud scroll (祥云) pattern, white on dark */
	--nccs-cloud-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='56' viewBox='0 0 160 56'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.10' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M14 40c0-8 6-13 12-13 5 0 10 3 10 8 0 5-4 8-8 8'/%3E%3Cpath d='M62 26c0-6 4-10 10-10 4 0 8 3 8 7'/%3E%3Cpath d='M112 42c0-7 5-12 11-12 4 0 8 3 8 8'/%3E%3C/g%3E%3C/svg%3E");
	/* Small Chinese-knot ornament: two interlaced diamonds, red centre */
	--nccs-knot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='44' viewBox='0 0 84 44'%3E%3Cg fill='none' stroke='%231663b8' stroke-width='2.5' stroke-linejoin='round'%3E%3Crect x='20' y='8' width='26' height='26' rx='7' transform='rotate(45 33 21)'/%3E%3Crect x='38' y='8' width='26' height='26' rx='7' transform='rotate(45 51 21)'/%3E%3C/g%3E%3Ccircle cx='42' cy='21' r='4.5' fill='%23bf3f2b'/%3E%3C/svg%3E");
}

/* ---------- sticky header, white background ---------- */
.nccs-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: #ffffff;
	box-shadow: 0 2px 14px rgba(14, 42, 71, 0.08);
}

/* Language-specific navigation: show only the nav matching the page language */
html[lang^="zh"] .nccs-nav-en {
	display: none !important;
}
html[lang^="en"] .nccs-nav-zh {
	display: none !important;
}

/* Language switcher: small blue pills in a row.
   Polylang's own stylesheet forces a vertical layout with full-width
   flex links, so these selectors must out-specify it. */
.pll-switcher.wp-block-polylang-language-switcher ul {
	display: flex;
	flex-direction: row;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.pll-switcher.wp-block-polylang-language-switcher li {
	margin: 0;
}
.pll-switcher.wp-block-polylang-language-switcher a {
	display: inline-flex;
	width: auto;
	height: auto;
	align-items: center;
	color: #1663b8;
	border: 1px solid #1663b8;
	border-radius: 999px;
	padding: 3px 12px;
	font-size: 14px;
	line-height: 1.5;
	text-decoration: none;
	white-space: nowrap;
}
.pll-switcher.wp-block-polylang-language-switcher li.current-lang a {
	background: #1663b8;
	color: #ffffff;
}

/* ---------- page banner (Bastion photo, every sub-page) ---------- */
.nccs-banner {
	min-height: 300px;
}
.nccs-banner .wp-block-cover__inner-container {
	padding-top: 48px;
	padding-bottom: 88px;
	text-align: center;
}
.nccs-banner-kicker {
	color: #cfe2f6;
	letter-spacing: 0.35em;
	font-size: 13px;
	text-transform: uppercase;
	margin: 0 0 10px;
}
.nccs-banner h1 {
	margin: 0;
	text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}
/* Red seal-stamp accent (华) at the banner's right edge */
.nccs-seal {
	position: absolute;
	right: clamp(20px, 6vw, 96px);
	top: 50%;
	transform: translateY(-50%) rotate(-5deg);
	width: 56px;
	height: 56px;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #bf3f2b;
	color: #ffffff;
	font-family: "Noto Serif CJK SC", "Songti SC", serif;
	font-size: 30px;
	line-height: 1;
	border: 2px solid rgba(255, 255, 255, 0.65);
	border-radius: 8px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* ---------- white content sheet overlapping the banner ----------
   Note: the sheet is a top-level block, so it needs explicit auto
   margins to centre itself (WP only centres the children). */
.nccs-sheet {
	background: #ffffff;
	border: 1px solid var(--nccs-line);
	border-radius: 18px;
	box-shadow: 0 14px 36px rgba(14, 42, 71, 0.1);
	padding: clamp(28px, 5vw, 56px);
	margin-top: -64px !important;
	margin-bottom: 72px;
	margin-left: auto;
	margin-right: auto;
	position: relative;
	z-index: 2;
	max-width: min(920px, calc(100% - 32px)) !important;
}
.nccs-sheet-wide {
	max-width: min(1240px, calc(100% - 32px)) !important;
}
.nccs-sheet h2 {
	border-left: 5px solid var(--nccs-blue);
	padding-left: 14px;
	margin-top: 1.6em;
}
.nccs-sheet h2:first-child {
	margin-top: 0;
}
.nccs-sheet h3::before {
	content: "";
	display: inline-block;
	width: 9px;
	height: 9px;
	background: var(--nccs-red);
	border-radius: 2px;
	margin-right: 10px;
	transform: rotate(45deg) translateY(-1px);
}

/* ---------- Chinese-knot divider (above the footer) ---------- */
.nccs-knot-divider {
	padding: 6px 0 36px;
}
.nccs-knot {
	display: flex;
	align-items: center;
	gap: 18px;
	height: 44px;
	margin: 0;
	background-image: var(--nccs-knot);
	background-repeat: no-repeat;
	background-position: center;
	background-size: 84px 44px;
}
.nccs-knot::before,
.nccs-knot::after {
	content: "";
	flex: 1;
	height: 1px;
}
.nccs-knot::before {
	background: linear-gradient(90deg, transparent, #b9cfe8);
}
.nccs-knot::after {
	background: linear-gradient(90deg, #b9cfe8, transparent);
}

/* ---------- home page ---------- */
.nccs-home-intro {
	border: 1px solid var(--nccs-line);
	box-shadow: 0 8px 24px rgba(14, 42, 71, 0.07);
}
.nccs-home-intro p {
	font-size: 18px;
	line-height: 1.8;
	margin: 0;
}
.nccs-home-news h2 {
	border-left: 5px solid var(--nccs-blue);
	padding-left: 14px;
}

/* Latest-posts as cards.
   NOTE: core sets .wp-block-latest-posts.is-grid:not(.is-layout-grid)
   to display:flex with higher specificity, so the :not() is needed here
   to win the display rule. */
ul.wp-block-latest-posts__list.is-grid:not(.is-layout-grid) {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}
ul.wp-block-latest-posts__list.is-grid li {
	background: #ffffff;
	border: 1px solid var(--nccs-line);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(14, 42, 71, 0.08);
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
ul.wp-block-latest-posts__list.is-grid li:hover {
	transform: translateY(-4px);
	box-shadow: 0 16px 34px rgba(14, 42, 71, 0.15);
}
.wp-block-latest-posts__featured-image {
	margin: 0;
}
.wp-block-latest-posts__featured-image img {
	width: 100%;
	height: 190px;
	object-fit: cover;
	display: block;
}
a.wp-block-latest-posts__post-title {
	display: block;
	color: var(--nccs-navy);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.45;
	padding: 18px 20px 0;
	text-decoration: none;
}
time.wp-block-latest-posts__post-date {
	color: var(--nccs-muted);
	font-size: 13px;
	padding: 8px 20px 20px;
}

/* ---------- news archive as a card grid ----------
   NOTE: in this WP version the post-template renders with
   .is-layout-grid, NOT .is-flex-container — selectors must not
   require the flex class, or nothing matches. */
.nccs-archive-grid .wp-block-post-template.is-layout-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}
.nccs-archive-grid .wp-block-post-template > li {
	background: #ffffff;
	border: 1px solid var(--nccs-line);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(14, 42, 71, 0.08);
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.nccs-archive-grid .wp-block-post-template > li:hover {
	transform: translateY(-4px);
	box-shadow: 0 16px 34px rgba(14, 42, 71, 0.15);
}
.nccs-archive-grid .wp-block-post-featured-image {
	margin: 0;
}
.nccs-archive-grid .wp-block-post-featured-image img {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	display: block;
}
.nccs-archive-grid .wp-block-post-title {
	font-size: 19px;
	line-height: 1.4;
	margin: 0 0 6px;
}
.nccs-archive-grid .wp-block-post-title a {
	color: var(--nccs-navy);
	text-decoration: none;
}
.nccs-archive-grid .wp-block-post-date {
	color: var(--nccs-muted);
	font-size: 13px;
}
.nccs-archive-grid .wp-block-post-excerpt {
	color: #33465c;
	font-size: 15px;
	line-height: 1.7;
}
.nccs-archive-grid .wp-block-post-excerpt__more-link {
	color: var(--nccs-blue);
	font-weight: 700;
}
.nccs-sheet .wp-block-search {
	max-width: 560px;
	margin-bottom: 36px;
}
.nccs-sheet .wp-block-search__input {
	border-radius: 999px;
	border: 1px solid var(--nccs-line);
	padding: 10px 18px;
}
.nccs-sheet .wp-block-search__button {
	border-radius: 999px;
}
.wp-block-query-pagination {
	margin-top: 40px;
}
.wp-block-query-pagination .page-numbers,
.wp-block-query-pagination .wp-block-query-pagination-previous,
.wp-block-query-pagination .wp-block-query-pagination-next {
	border: 1px solid var(--nccs-blue);
	border-radius: 999px;
	padding: 6px 14px;
	text-decoration: none;
	margin: 0 3px;
	display: inline-block;
}
.wp-block-query-pagination .page-numbers.current {
	background: var(--nccs-blue);
	color: #ffffff;
}

/* ---------- single article ---------- */
.nccs-title-band {
	background: linear-gradient(120deg, #0e2a47 0%, #123c66 55%, #1663b8 100%);
	padding: 56px 24px 100px;
	position: relative;
	overflow: hidden;
}
.nccs-title-band::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: var(--nccs-cloud-light);
	background-repeat: repeat;
	pointer-events: none;
}
.nccs-title-band > * {
	position: relative;
	z-index: 1;
}
.nccs-title-band h1 {
	color: #ffffff;
	text-align: center;
	max-width: 820px;
	margin: 0 auto 14px;
	text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}
.nccs-title-band .wp-block-post-date,
.nccs-title-band .wp-block-post-terms {
	color: #cfe2f6;
}
.nccs-title-band a {
	color: #ffffff;
}
.nccs-back-link a {
	color: #cfe2f6;
	text-decoration: none;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 999px;
	padding: 4px 14px;
	font-size: 14px;
}
.nccs-back-link a:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #ffffff;
}
.nccs-sheet-single .wp-block-post-content > p {
	line-height: 1.9;
}
.nccs-sheet-single .wp-block-post-content .wp-block-image img {
	border-radius: 12px;
	box-shadow: 0 10px 28px rgba(14, 42, 71, 0.14);
}
.nccs-sheet-single blockquote {
	background: var(--nccs-sky);
	border-left: 4px solid var(--nccs-blue);
	border-radius: 0 12px 12px 0;
	padding: 22px 26px;
	margin: 28px 0;
}
.nccs-sheet-single blockquote p {
	margin: 0;
}
.nccs-post-nav {
	border-top: 1px solid var(--nccs-line);
	margin-top: 48px;
	padding-top: 28px;
	gap: 16px;
}
.nccs-post-nav a {
	display: inline-block;
	border: 1px solid var(--nccs-line);
	border-radius: 12px;
	padding: 14px 18px;
	background: var(--nccs-mist);
	text-decoration: none;
	color: var(--nccs-navy);
}
.nccs-post-nav a:hover {
	border-color: var(--nccs-blue);
}

/* Article images: centered, rounded corners (matches old site) */
.wp-block-image img {
	border-radius: 8px;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
	ul.wp-block-latest-posts__list.is-grid:not(.is-layout-grid),
	.nccs-archive-grid .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.nccs-seal {
		display: none;
	}
}
@media (max-width: 600px) {
	ul.wp-block-latest-posts__list.is-grid:not(.is-layout-grid),
	.nccs-archive-grid .wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr;
	}
	.nccs-sheet {
		margin-top: -40px;
		padding: 24px 20px;
	}
	.nccs-banner {
		min-height: 240px;
	}
}
