/*
 * Layout: the page furniture templates are built from.
 *
 * Each class here is used by a template or a pattern in this theme. Blocks
 * have their own files in the blocks folder.
 */

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

.civic-header {
	border-block-end: 1px solid var(--wp--preset--color--line);
	background: var(--wp--preset--color--base);
}

.civic-header__bar {
	gap: 0.75rem 2rem;
	padding-block: 0.875rem;
}

.civic-header__brand {
	gap: 0.875rem;
	min-width: 0;
}

/*
 * A logo of any shape is held to one height.
 *
 * The height is fixed, not a limit. With a fixed height the browser can
 * work out the logo's box from the size written in the markup, before
 * the picture has arrived. With a limit it could not: the logo took no
 * room at first, and on a phone the menu button dropped to a second row
 * when the picture loaded, pushing the page down.
 */
.civic-header__brand .wp-block-site-logo img {
	width: auto;
	max-width: 12rem;
	height: 4rem;
	object-fit: contain;
}

.civic-header__brand .wp-block-site-title {
	margin: 0;
}

/* ---------- Page header: the band that holds the page title ---------- */

.civic-page-header {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding-block: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
	background-color: var(--wp--preset--color--surface);
}

.civic-page-header::before {
	mask: var(--civic-chart-lines) right top / 44rem auto no-repeat;
}

.civic-page-header > * {
	margin-block: 0;
}

.civic-page-header > * + * {
	margin-block-start: var(--wp--preset--spacing--30);
}

/* A small label above a title, naming the kind of page. */
.civic-eyebrow {
	color: var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.civic-lede {
	max-width: 40rem;
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.45;
}

/* ---------- Main content area ---------- */

.civic-main {
	padding-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--60);
}

/*
 * Content with a side panel. On wide screens the panel sits beside the
 * content. On narrow screens it follows the content, which is the order
 * the two appear in the markup.
 */
.civic-with-aside {
	display: grid;
	gap: var(--wp--preset--spacing--50);
	align-items: start;
}

.civic-with-aside > * {
	min-width: 0;
	margin-block: 0;
}

@media (min-width: 62em) {

	.civic-with-aside {
		grid-template-columns: minmax(0, 1fr) 20rem;
		gap: var(--wp--preset--spacing--60);
	}
}

.civic-aside {
	padding: 1.5rem;
	border-block-start: 4px solid var(--wp--preset--color--primary);
	border-radius: 0 0 6px 6px;
	background: var(--wp--preset--color--surface);
}

.civic-aside > * {
	margin-block: 0;
}

.civic-aside > * + * {
	margin-block-start: 1rem;
}

.civic-aside h2 {
	font-size: var(--wp--preset--font-size--large);
}

/* ---------- Home page ---------- */

.civic-hero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding-block: var(--wp--preset--spacing--60);
	background-color: var(--wp--preset--color--surface);
}

.civic-hero::before {
	mask: var(--civic-chart-lines) right center / 64rem auto no-repeat;
}

.civic-hero__inner {
	display: grid;
	gap: var(--wp--preset--spacing--50);
	align-items: center;
}

.civic-hero__inner > * {
	min-width: 0;
	margin-block: 0;
}

@media (min-width: 62em) {

	.civic-hero__inner {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
	}
}

.civic-hero__text > * {
	margin-block: 0;
}

.civic-hero__text > * + * {
	margin-block-start: var(--wp--preset--spacing--30);
}

.civic-hero__title {
	font-size: var(--wp--preset--font-size--display);
}

.civic-hero__image img {
	width: 100%;
	height: auto;
	border-radius: 10px;
	box-shadow: var(--wp--preset--shadow--raised);
}

.civic-section {
	padding-block: var(--wp--preset--spacing--60);
}

.civic-section--tinted {
	background: var(--wp--preset--color--surface);
}

.civic-section--warm {
	background: var(--wp--preset--color--sand);
}

.civic-section > * {
	margin-block: 0;
}

.civic-section > * + * {
	margin-block-start: var(--wp--preset--spacing--40);
}

/* Two equal columns that stack on narrow screens. */
.civic-columns {
	display: grid;
	gap: var(--wp--preset--spacing--50);
}

.civic-columns > * {
	min-width: 0;
	margin-block: 0;
}

@media (min-width: 56em) {

	.civic-columns {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--wp--preset--spacing--60);
	}
}

.civic-columns__column > * {
	margin-block: 0;
}

.civic-columns__column > * + * {
	margin-block-start: var(--wp--preset--spacing--30);
}

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

.civic-footer {
	padding-block: var(--wp--preset--spacing--60) var(--wp--preset--spacing--40);
	background: var(--wp--preset--color--deep);
	color: var(--wp--preset--color--base);
}

.civic-footer :is(h2, h3, a, .wp-block-site-title a) {
	color: var(--wp--preset--color--base);
}

.civic-footer a:hover {
	color: var(--wp--preset--color--tide);
}

/* On the dark footer the light halo of the focus ring does the work. */
.civic-footer :focus-visible {
	outline-color: var(--wp--preset--color--base);
}

.civic-footer__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
	gap: var(--wp--preset--spacing--50);
}

.civic-footer__grid > * {
	min-width: 0;
	margin-block: 0;
}

.civic-footer__column > * {
	margin-block: 0;
}

.civic-footer__column > * + * {
	margin-block-start: 0.875rem;
}

.civic-footer__column h2 {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.civic-footer__links {
	display: grid;
	gap: 0.5rem;
	padding: 0;
	list-style: none;
}

.civic-footer__links li {
	margin: 0;
}

.civic-footer__legal {
	margin-block-start: var(--wp--preset--spacing--50);
	padding-block-start: var(--wp--preset--spacing--30);
	border-block-start: 1px solid rgb(255 255 255 / 0.25);
	font-size: var(--wp--preset--font-size--small);
}

/* ---------- Shared pieces ---------- */

/*
 * The chart lines behind page headers: thin contour lines, like the depth
 * lines on a harbor chart. The drawing is used as a mask over a block of
 * the brand color, so it follows the palette when a city changes it. It is
 * decoration and carries no meaning.
 */
:root {
	--civic-chart-lines: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 360' fill='none' stroke='%23000' stroke-width='1.3'%3E%3Cpath d='M380 -10c40 60 150 40 190 110s-30 130 40 190 150 20 210 90'/%3E%3Cpath d='M440 -10c30 50 130 30 170 95s-20 120 45 175 120 15 165 75'/%3E%3Cpath d='M500 -10c25 40 110 25 145 80s-10 105 45 155 95 10 130 60'/%3E%3Cpath d='M565 -10c18 30 85 20 115 62s0 88 44 130 66 8 96 45'/%3E%3Cpath d='M630 -10c12 22 60 14 84 46s8 66 40 98 40 6 62 30'/%3E%3Cpath d='M700 -10c8 14 36 10 52 30s10 42 30 62 20 4 34 16'/%3E%3C/svg%3E");
}

.civic-page-header::before,
.civic-hero::before {
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--wp--preset--color--primary);
	content: "";
	opacity: 0.16;
	pointer-events: none;
}

/* A list of posts shown as cards, used for news. */
.civic-cards .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
	gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
	margin: 0;
	padding: 0;
	list-style: none;
}

.civic-cards .wp-block-post {
	display: grid;
	gap: 0.5rem;
	align-content: start;
	margin: 0;
}

.civic-cards .wp-block-post > * {
	margin-block: 0;
}

.civic-cards .wp-block-post-title {
	font-size: var(--wp--preset--font-size--large);
}

.civic-cards .wp-block-post-title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.civic-cards .wp-block-post-title a:hover {
	text-decoration: underline;
}

.civic-cards .wp-block-post-featured-image {
	margin-block-end: 0.375rem;
}

.civic-cards .wp-block-post-featured-image img {
	border-radius: 8px;
}

/* A plain list of posts: date above title, with a rule between entries. */
.civic-post-list .wp-block-post-template {
	margin: 0;
	padding: 0;
	list-style: none;
}

.civic-post-list .wp-block-post {
	margin: 0;
	padding-block: 0.875rem;
	border-block-start: 1px solid var(--wp--preset--color--line);
}

.civic-post-list .wp-block-post > * {
	margin-block: 0;
}

.civic-post-list .wp-block-post-title {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
	letter-spacing: 0;
}

/* Search results: the kind of content, the title, one fact, the summary. */
.civic-results .wp-block-post-template {
	margin: 0;
	padding: 0;
	list-style: none;
}

.civic-results .wp-block-post {
	margin: 0;
	padding-block: 1.25rem;
	border-block-start: 1px solid var(--wp--preset--color--line);
}

.civic-results .wp-block-post > * {
	margin-block: 0;
}

.civic-results .wp-block-post > * + * {
	margin-block-start: 0.25rem;
}

.civic-result__type {
	color: var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.civic-results .wp-block-post-title {
	font-size: var(--wp--preset--font-size--large);
}

.civic-result__fact {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

/* Empty paragraphs from bound blocks with nothing to show take no room. */
.civic-result__type:empty,
.civic-result__fact:empty {
	display: none;
}

.wp-block-query-pagination {
	margin-block-start: var(--wp--preset--spacing--50);
	padding-block-start: var(--wp--preset--spacing--30);
	border-block-start: 1px solid var(--wp--preset--color--line);
	font-weight: 600;
}

/* A call out panel, used by the notice and contact patterns. */
.civic-panel {
	padding: 1.5rem;
	border-inline-start: 5px solid var(--wp--preset--color--primary);
	border-radius: 0 6px 6px 0;
	background: var(--wp--preset--color--tide);
}

.civic-panel > * {
	margin-block: 0;
}

.civic-panel > * + * {
	margin-block-start: 0.75rem;
}

/* ---------- Page frame ---------- */

/*
 * The header, the main area and the footer sit flush against each other.
 * Each one manages its own inner spacing.
 */
.wp-site-blocks > *,
.civic-main-wrap > * {
	margin-block: 0;
}

.civic-main > * + *,
.civic-with-aside__main > * + * {
	margin-block-start: var(--wp--preset--spacing--40);
}

.civic-with-aside__main > :first-child {
	margin-block-start: 0;
}

.civic-main :is(h2, h3):not(:first-child) {
	margin-block-start: var(--wp--preset--spacing--50);
}

/* Content written in the home page itself shares the wide column. */
.civic-home-content:empty {
	display: none;
}
