/*
 * First State Bank, Elmore City - site styles.
 *
 * Decisions that hold on every page:
 * 1. Bands run edge to edge; what is inside them sits on the theme container (--x-edge).
 * 2. Text lives in a two-column ledger: a label column on the left, the text column on the
 *    right, a red double margin rule between them, blue rules between rows.
 * 3. Photographs are mounted prints (white mat, thin rule). They are never page backgrounds.
 * 4. Dark bands carry engraved line work: a rosette and a lace edge.
 *
 * Colors come from the Kadence palette (--global-palette1..10).
 * Breakpoints: 767px (phone), 1024px (tablet).
 */

/* ---------- Tokens ---------- */
:root {
	--x-edge: max(var(--global-content-edge-padding), calc((100% - var(--global-content-width)) / 2 + var(--global-content-edge-padding)));
	--x-label: 288px;
	--x-gap: 72px;
	--x-band: clamp(56px, 7vw, 104px);
	--x-measure: 66ch;
	--x-display: var(--global-heading-font-family, Besley, Georgia, serif);
	--x-shadow: 0 22px 44px -24px color-mix(in srgb, var(--global-palette3) 70%, transparent);
}

/* ---------- Base ---------- */
.site-footer a,
.header-html a {
	text-decoration-line: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

:where(a, button, input, summary):focus-visible {
	outline: 3px solid var(--global-palette1);
	outline-offset: 3px;
}

/*
 * Page content. Everything below is scoped to the content area (and to the editor canvas),
 * which also lifts these rules above the theme's own spacing rules for content.
 */
:is(.entry-content.single-content, .is-root-container.wp-block-post-content) {
	> .wp-block-group {
		max-width: none;
		margin-block: 0;
		padding-inline: var(--x-edge);
	}

	a:not(.wp-block-button__link) {
		text-decoration-line: underline;
		text-decoration-thickness: 1px;
		text-underline-offset: 0.18em;
	}

	a:not(.wp-block-button__link):hover {
		text-decoration-thickness: 2px;
	}

	.wp-block-button__link {
		padding: 0.85em 1.5em;
	}

	ul.wp-block-list {
		padding-left: 1.15em;
	}

	ul.wp-block-list li + li {
		margin-top: 0.3em;
	}

	ul.wp-block-list li::marker {
		color: var(--global-palette10);
	}

	/* ---------- Photographs as mounted prints ---------- */
	.wp-block-image {
		margin: 0;
		padding: 10px;
		background: var(--global-palette9);
		border: 1px solid var(--global-palette7);
		box-shadow: var(--x-shadow);
	}

	.wp-block-image img {
		display: block;
		width: 100%;
		height: auto;
		aspect-ratio: 3 / 2;
		object-fit: cover;
	}

	.wp-block-image figcaption {
		margin: 0;
		padding: 12px 4px 4px;
		font-family: var(--x-display);
		font-style: italic;
		font-weight: 500;
		font-size: 0.9375rem;
		line-height: 1.4;
		text-align: left;
		color: var(--global-palette5);
	}

	/* ---------- Masthead ---------- */
	.x-masthead {
		position: relative;
		isolation: isolate;
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		align-items: center;
		column-gap: clamp(32px, 5vw, 88px);
		padding-block: var(--x-band);
		background: var(--global-palette3);
		color: var(--global-palette9);
	}

	.x-masthead::before,
	.x-charter::before {
		content: "";
		position: absolute;
		inset: 0;
		z-index: -1;
		background: var(--global-palette1);
		opacity: 0.6;
		-webkit-mask: url(../img/rosette.svg) no-repeat right -190px center / 680px 680px;
		mask: url(../img/rosette.svg) no-repeat right -190px center / 680px 680px;
	}

	.x-masthead::after,
	.x-charter::after {
		content: "";
		position: absolute;
		inset: auto 0 0;
		height: 16px;
		background: var(--global-palette1);
		-webkit-mask: url(../img/lace.svg) repeat-x center / 56px 16px;
		mask: url(../img/lace.svg) repeat-x center / 56px 16px;
	}

	.x-masthead:has(> .wp-block-image) {
		grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
	}

	.x-masthead-text > * {
		margin-block: 0;
	}

	.x-masthead h1 {
		color: var(--global-palette9);
		max-width: 16ch;
		text-wrap: balance;
	}

	.x-masthead-text > p {
		margin-top: 1.1em;
		max-width: 40ch;
		font-size: 1.3125rem;
		line-height: 1.45;
		color: color-mix(in srgb, var(--global-palette9) 84%, var(--global-palette1));
	}

	.x-masthead-text > .wp-block-buttons {
		margin-top: 2rem;
	}

	.x-masthead .wp-block-button__link {
		background: var(--global-palette9);
		color: var(--global-palette3);
	}

	.x-masthead .wp-block-button__link:hover,
	.x-masthead .wp-block-button__link:focus {
		background: var(--global-palette8);
		color: var(--global-palette3);
	}

	.x-masthead :where(a, button):focus-visible {
		outline-color: var(--global-palette9);
	}

	/* The print hangs below the band and into the next section. */
	.x-masthead > .wp-block-image {
		position: relative;
		z-index: 1;
		align-self: end;
		margin-bottom: calc(-1 * var(--x-band) - 56px);
		border-color: transparent;
	}

	.x-hero h1 {
		max-width: none;
		font-size: clamp(2.5rem, 4.4vw, 3.875rem);
		line-height: 1.02;
	}

	.x-hero > .wp-block-image img {
		aspect-ratio: 7 / 4;
	}

	/* ---------- Section index on the Personal pages ---------- */
	.x-subnav {
		padding-block: 26px;
		border-bottom: 1px solid var(--global-palette7);
	}

	.x-subnav ul.wp-block-list {
		display: flex;
		flex-wrap: wrap;
		gap: 6px 36px;
		margin: 0;
		padding: 0;
		list-style: none;
		font-weight: 600;
		max-width: 52%;
	}

	.x-subnav ul.wp-block-list li {
		margin: 0;
	}

	.x-subnav + .x-ledger {
		padding-top: 0;
	}

	.x-subnav + .x-ledger > .x-entry:first-child {
		border-top: 0;
	}

	.x-subnav strong {
		padding-bottom: 3px;
		border-bottom: 2px solid var(--global-palette10);
		color: var(--global-palette3);
	}

	.x-subnav a {
		text-decoration: none;
	}

	.x-subnav a:hover {
		text-decoration: underline;
	}

	/* ---------- Ledger ---------- */
	.x-ledger,
	.x-prose,
	.x-letter,
	.x-note,
	.x-board,
	.x-history,
	.x-resources,
	.x-sharing {
		position: relative;
		padding-block: var(--x-band);
		--x-rule-left: var(--x-edge);
	}

	/* red double margin rule between the label column and the text column */
	.x-ledger::before,
	.x-prose::before,
	.x-letter::before,
	.x-board::before,
	.x-history::before {
		content: "";
		position: absolute;
		top: 0;
		bottom: 0;
		left: calc(var(--x-rule-left) + var(--x-label) + var(--x-gap) / 2 - 3px);
		width: 5px;
		border-inline: 1px solid var(--global-palette10);
		opacity: 0.55;
		pointer-events: none;
	}

	.x-entry,
	.x-board,
	.x-history,
	.x-visit,
	.x-resources {
		display: grid;
		grid-template-columns: var(--x-label) minmax(0, 1fr);
		column-gap: var(--x-gap);
	}

	.x-entry {
		padding-block: 34px;
		border-top: 1px solid var(--global-palette7);
	}

	.x-entry:last-child {
		border-bottom: 1px solid var(--global-palette7);
	}

	.x-entry > :is(h2, h3),
	.x-board > h2,
	.x-visit > h2,
	.x-resources > h2 {
		grid-column: 1;
		grid-row: 1 / span 40;
		margin: 0;
		font-size: 1.4375rem;
		line-height: 1.22;
		text-wrap: balance;
	}

	.x-entry > :not(h2, h3),
	.x-board > :not(h2),
	.x-visit > :not(h2),
	.x-resources > :not(h2) {
		grid-column: 2;
		margin-block: 0;
		max-width: var(--x-measure);
	}

	.x-entry > :not(h2, h3) ~ :not(h2, h3) {
		margin-top: 1em;
	}

	.x-ledger > h2 {
		margin: 0 0 32px;
	}

	/* two white sections in a row share one band of space */
	:is(.x-ledger, .x-prose, .x-letter, .x-board, .x-history, .x-sharing) + :is(.x-ledger, .x-prose, .x-letter, .x-board, .x-history, .x-sharing) {
		padding-top: 0;
	}

	/* a ledger placed inside another section (the history timeline) */
	.x-history > .x-ledger {
		grid-column: 1 / -1;
		padding-block: 48px 0;
	}

	.x-history > .x-ledger::before {
		display: none;
	}

	.x-history .x-entry > h3 {
		font-size: 2.125rem;
		line-height: 1;
		font-weight: 700;
		color: var(--global-palette1);
		font-variant-numeric: lining-nums;
	}

	/* ---------- Text sections on the ledger's text column ---------- */
	.x-prose > *,
	.x-letter > *,
	.x-note > * {
		margin-block: 0;
		margin-left: calc(var(--x-label) + var(--x-gap));
		max-width: var(--x-measure);
	}

	.x-prose > * + *,
	.x-letter > * + *,
	.x-note > * + * {
		margin-top: 1.15em;
	}

	.x-prose > h2 {
		margin-top: 1.6em;
	}

	.x-prose > p:first-child,
	.x-letter > p:first-child {
		font-size: 1.3125rem;
		line-height: 1.5;
		color: var(--global-palette3);
	}

	.x-letter > p:last-child {
		margin-top: 1.6em;
		font-family: var(--x-display);
		color: var(--global-palette3);
	}

	.x-letter > p:last-child strong {
		font-size: 1.3125rem;
		font-weight: 600;
	}

	.wp-block-quote {
		margin-block: 2em 0;
		padding: 0 0 0 28px;
		border-left: 3px solid var(--global-palette1);
		font-family: var(--x-display);
		font-size: 1.625rem;
		line-height: 1.3;
		font-style: italic;
		font-weight: 500;
		color: var(--global-palette3);
	}

	.wp-block-quote p {
		margin: 0;
	}

	.wp-block-quote cite {
		display: block;
		margin-top: 14px;
		font-family: var(--global-body-font-family);
		font-size: 1rem;
		font-style: normal;
		font-weight: 400;
		color: var(--global-palette5);
	}

	.x-note {
		background: var(--global-palette8);
		padding-block: 56px;
	}

	.x-note > h2 {
		font-size: 1.4375rem;
	}

	/* ---------- History ---------- */
	.x-history-head {
		display: contents;
	}

	.x-history-head > h2 {
		grid-column: 1;
		margin: 0;
	}

	.x-history-head > p {
		grid-column: 2;
		margin: 0 0 36px;
		max-width: var(--x-measure);
	}

	.x-history > .wp-block-image {
		grid-column: 2;
		max-width: 760px;
	}

	.x-history > .wp-block-image img {
		aspect-ratio: 7 / 4;
	}

	/* ---------- Tables ---------- */
	.wp-block-table {
		margin: 0;
	}

	.wp-block-table table {
		width: 100%;
		border-collapse: collapse;
		border: 0;
		font-variant-numeric: tabular-nums;
	}

	.wp-block-table :is(td, th) {
		padding: 14px 20px 14px 0;
		border: 0;
		border-bottom: 1px solid var(--global-palette7);
		text-align: left;
		vertical-align: top;
	}

	.wp-block-table th {
		font-family: var(--x-display);
		font-weight: 600;
		font-size: 1rem;
		line-height: 1.3;
		color: var(--global-palette3);
		border-bottom: 2px solid var(--global-palette3);
	}

	.wp-block-table tbody tr:first-child td {
		border-top: 1px solid var(--global-palette7);
	}

	.wp-block-table thead + tbody tr:first-child td {
		border-top: 0;
	}

	.wp-block-table td:first-child {
		font-weight: 600;
		color: var(--global-palette3);
	}

	.x-sharing th:first-child,
	.x-sharing td:first-child {
		width: 58%;
		font-weight: 400;
		color: inherit;
	}

	.x-sharing td:first-child strong {
		color: var(--global-palette3);
	}

	.x-sharing > p {
		margin: 28px 0 0;
	}

	/* ---------- Home: accounts and services ---------- */
	.x-doors {
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		column-gap: 36px;
		padding-block: calc(var(--x-band) + 40px) calc(var(--x-band) - 24px);
		background: var(--global-palette8);
	}

	.x-door {
		padding-top: 20px;
		border-top: 2px solid var(--global-palette3);
	}

	.x-door > h2 {
		margin: 0;
		font-size: 1.375rem;
		line-height: 1.2;
	}

	.x-door > h2 a {
		color: var(--global-palette3);
		text-decoration: none;
	}

	.x-door > h2 a:hover {
		color: var(--global-palette1);
		text-decoration: underline;
		text-decoration-thickness: 2px;
	}

	.x-door > p {
		margin: 12px 0 0;
		font-size: 1.0625rem;
		line-height: 1.5;
		color: var(--global-palette5);
	}

	/* ---------- Home: welcome ---------- */
	.x-welcome {
		display: grid;
		grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
		column-gap: var(--x-gap);
		align-items: start;
		padding-block: var(--x-band);
	}

	.x-welcome-head > h2 {
		margin: 0;
		font-size: clamp(2.25rem, 4vw, 3.25rem);
		line-height: 1.05;
	}

	.x-welcome-head > p {
		margin: 28px 0 0;
		padding-left: 24px;
		border-left: 3px solid var(--global-palette10);
		font-family: var(--x-display);
		font-style: italic;
		font-weight: 500;
		font-size: 1.5rem;
		line-height: 1.35;
		color: var(--global-palette1);
		max-width: 22ch;
	}

	.x-welcome-body > p {
		margin: 0;
		max-width: var(--x-measure);
	}

	.x-welcome-body > p + p {
		margin-top: 1.1em;
	}

	/* ---------- Home: the charter ---------- */
	.x-charter {
		position: relative;
		isolation: isolate;
		display: grid;
		grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
		column-gap: var(--x-gap);
		align-items: center;
		padding-block: var(--x-band);
		background: var(--global-palette3);
		color: var(--global-palette9);
	}

	.x-charter::before {
		-webkit-mask-position: left -220px center;
		mask-position: left -220px center;
	}

	.x-charter > .wp-block-image {
		max-width: 460px;
		border-color: transparent;
	}

	.x-charter > .wp-block-image img {
		aspect-ratio: 600 / 427;
	}

	.x-charter-text > * {
		margin-block: 0;
	}

	.x-charter-text > h2 {
		color: var(--global-palette9);
		font-size: clamp(1.875rem, 3.2vw, 2.625rem);
		line-height: 1.12;
		max-width: 24ch;
		text-wrap: balance;
	}

	.x-charter-text > p {
		margin-top: 1.2em;
		max-width: 52ch;
		color: color-mix(in srgb, var(--global-palette9) 86%, var(--global-palette1));
	}

	.x-charter a {
		color: var(--global-palette9);
		font-weight: 600;
	}

	.x-charter a:focus-visible {
		outline-color: var(--global-palette9);
	}

	/* ---------- Home: hours ---------- */
	.x-visit {
		padding-block: var(--x-band);
	}

	.x-visit > p {
		margin-top: 22px;
	}

	/* ---------- Home: resources ---------- */
	.x-resources {
		padding-block: 64px;
		background: var(--global-palette8);
	}

	.x-resources ul.wp-block-list {
		padding: 0;
		list-style: none;
	}

	.x-resources ul.wp-block-list li {
		margin: 0;
		padding-block: 12px;
		border-bottom: 1px solid var(--global-palette7);
		font-weight: 600;
	}

	.x-resources ul.wp-block-list li:first-child {
		padding-top: 0;
	}

	/* ---------- Tablet ---------- */
	@media (max-width: 1024px) {
		:root {
			--x-label: 208px;
			--x-gap: 48px;
		}

		.x-doors {
			grid-template-columns: repeat(3, minmax(0, 1fr));
			row-gap: 36px;
		}

		.x-subnav ul.wp-block-list {
			max-width: none;
		}

		.x-masthead:has(> .wp-block-image) {
			grid-template-columns: minmax(0, 1fr);
			row-gap: 40px;
		}

		.x-masthead > .wp-block-image {
			max-width: 620px;
			margin-bottom: calc(-1 * var(--x-band) - 40px);
		}

		.x-masthead + .wp-block-group {
			padding-top: 72px;
		}

		.x-masthead:not(:has(> .wp-block-image)) + .wp-block-group {
			padding-top: var(--x-band);
		}

		.x-masthead + .x-subnav {
			padding-bottom: 26px;
		}
	}

	/* ---------- Phone ---------- */
	@media (max-width: 767px) {
		.x-entry,
		.x-board,
		.x-history,
		.x-resources,
		.x-welcome,
		.x-charter,
		.x-visit {
			grid-template-columns: minmax(0, 1fr);
			row-gap: 28px;
		}

		.x-entry {
			row-gap: 0;
		}

		.x-entry > :is(h2, h3),
		.x-board > h2,
		.x-visit > h2,
		.x-resources > h2 {
			grid-row: auto;
			margin-bottom: 14px;
		}

		.x-entry > :not(h2, h3),
		.x-board > :not(h2),
		.x-visit > :not(h2),
		.x-resources > :not(h2),
		.x-history-head > p,
		.x-history > .wp-block-image {
			grid-column: 1;
		}

		.x-prose > *,
		.x-letter > *,
		.x-note > * {
			margin-left: 0;
		}

		.x-ledger::before,
		.x-prose::before,
		.x-letter::before,
		.x-board::before,
		.x-history::before {
			display: none;
		}

		.x-doors {
			grid-template-columns: minmax(0, 1fr);
			row-gap: 28px;
		}

		.x-masthead::before,
		.x-charter::before {
			-webkit-mask-size: 460px 460px;
			mask-size: 460px 460px;
			-webkit-mask-position: right -200px top -120px;
			mask-position: right -200px top -120px;
		}

		.x-sharing :is(td, th) {
			font-size: 0.9375rem;
			padding-right: 12px;
			word-break: normal;
			overflow-wrap: normal;
		}

		.x-sharing th:first-child,
		.x-sharing td:first-child {
			width: 46%;
		}

		.x-sharing th {
			font-size: 0.8125rem;
		}
	}
}

/* ---------- Header ---------- */
.site-top-header-wrap .site-header-row-container-inner {
	border-bottom: 1px solid var(--global-palette7);
}

.site-header-top-section-left,
.site-header-top-section-left .site-header-item,
.header-html {
	flex: 1 1 auto;
	width: 100%;
}

.header-html-inner {
	display: flex;
	justify-content: space-between;
	gap: 24px;
}

.site-branding .site-title-wrap {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.site-branding .brand img {
	height: auto;
}

.main-navigation .primary-menu-container > ul > li.menu-item > a {
	text-decoration: none;
}

.site-header .header-button {
	margin-left: 12px;
}

/* the drawer is dark, so its button turns light */
#mobile-drawer .mobile-header-button {
	margin-top: 12px;
	background: var(--global-palette9);
	color: var(--global-palette3);
}

#mobile-drawer .mobile-header-button:hover,
#mobile-drawer .mobile-header-button:focus {
	background: var(--global-palette8);
	color: var(--global-palette3);
}

#mobile-drawer :where(a, button):focus-visible {
	outline-color: var(--global-palette9);
}

/* ---------- Footer ---------- */
.site-footer {
	position: relative;
}

.site-footer::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 16px;
	background: var(--global-palette1);
	-webkit-mask: url(../img/lace.svg) repeat-x center / 56px 16px;
	mask: url(../img/lace.svg) repeat-x center / 56px 16px;
}

.site-footer .site-middle-footer-inner-wrap {
	align-items: start;
}

.site-footer .wp-block-image {
	margin: 0 0 20px;
}

.site-footer .wp-block-image img {
	width: 104px;
	height: auto;
}

.site-footer .footer-widget-area h2 {
	margin: 0 0 14px;
	font-size: 1.125rem;
	line-height: 1.3;
	color: var(--global-palette9);
}

.site-footer .footer-widget-area p {
	margin: 0 0 12px;
}

.site-footer .footer-widget-area em {
	font-family: var(--x-display);
	font-weight: 500;
}

.site-footer .footer-widget-area ul.wp-block-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer .footer-widget-area ul.wp-block-list li + li {
	margin-top: 8px;
}

.site-footer .footer-widget-area a,
.site-footer .footer-html a {
	text-decoration-color: color-mix(in srgb, var(--global-palette9) 45%, transparent);
}

.site-footer .footer-widget-area a:hover,
.site-footer .footer-html a:hover {
	text-decoration-color: currentColor;
}

.site-footer :where(a):focus-visible {
	outline-color: var(--global-palette9);
}

.site-bottom-footer-wrap .site-footer-row-container-inner {
	border-top: 1px solid color-mix(in srgb, var(--global-palette9) 18%, transparent);
}

.site-footer .footer-html-inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 8px 40px;
}

.site-footer .footer-html-inner p {
	margin: 0;
}

.site-footer .footer-html {
	text-align: left;
}

.site-footer .footer-html-inner :is(.x-legal, .x-marks) {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 24px;
}

@media (max-width: 767px) {
	.header-html-inner {
		flex-direction: column;
		gap: 2px;
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important; /* the theme sets its own transitions on links and buttons */
		scroll-behavior: auto !important;
	}
}
