/*
Theme Name: Manorhamilton Heritage
Theme URI: https://example.org/
Author: Manorhamilton Historical Society
Author URI: https://example.org/
Description: A lightweight, accessible WordPress theme for a community heritage portal.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.6
Requires PHP: 8.0
Text Domain: manorhamilton-heritage
*/

:root {
	--mhs-bg: #fbf7ed;
	--mhs-bg-soft: #f4ecdc;
	--mhs-panel: #fffdf8;
	--mhs-ink: #211d16;
	--mhs-heading: #183f35;
	--mhs-muted: #5d5a50;
	--mhs-border: #d8cdb8;
	--mhs-green: #285849;
	--mhs-green-dark: #17382f;
	--mhs-brown: #4a3324;
	--mhs-rust: #8c472e;
	--mhs-gold: #b88b33;
	--mhs-gold-soft: #ead8aa;
	--mhs-focus: #0b57d0;
	--mhs-danger: #8a1f14;
	--mhs-radius: 8px;
	--mhs-shadow: 0 12px 28px rgba(33, 29, 22, 0.09);
	--mhs-measure: 72ch;
}

* {
	box-sizing: border-box;
}

html {
	font-size: 18px;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--mhs-bg);
	color: var(--mhs-ink);
	font-family: Georgia, "Times New Roman", serif;
	line-height: 1.68;
	text-rendering: optimizeLegibility;
}

body,
button,
input,
select,
textarea {
	font-size: 1rem;
}

button,
input,
select,
textarea,
.site-title,
.site-description,
.primary-menu,
.button,
.wp-block-button__link,
.entry-meta,
.card-kicker,
.card-meta-line,
.taxonomy-list,
.mhs-form-note,
.section-kicker,
.pagination {
	font-family: Arial, Helvetica, sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	color: var(--mhs-heading);
	line-height: 1.15;
	margin: 0 0 0.75rem;
}

h1 {
	font-size: clamp(2.15rem, 5vw, 4rem);
	letter-spacing: 0;
}

h2 {
	font-size: clamp(1.55rem, 3vw, 2.25rem);
}

h3 {
	font-size: 1.28rem;
}

p {
	margin: 0 0 1rem;
}

a {
	color: var(--mhs-green-dark);
	text-decoration-thickness: 0.08em;
	text-underline-offset: 0.18em;
}

a:hover {
	color: var(--mhs-rust);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
	outline: 3px solid var(--mhs-focus);
	outline-offset: 3px;
}

img,
iframe,
video,
audio,
embed,
object {
	max-width: 100%;
}

img {
	height: auto;
}

figure {
	margin: 0 0 1.25rem;
}

figcaption {
	color: var(--mhs-muted);
	font-size: 0.92rem;
	margin-top: 0.45rem;
}

table {
	width: 100%;
	border-collapse: collapse;
	margin: 1rem 0;
}

th,
td {
	border: 1px solid var(--mhs-border);
	padding: 0.65rem;
	text-align: left;
	vertical-align: top;
}

th {
	background: var(--mhs-bg-soft);
	color: var(--mhs-heading);
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 1rem;
	z-index: 1000;
	background: var(--mhs-ink);
	color: #fff;
	padding: 0.65rem 0.9rem;
}

.skip-link:focus {
	left: 1rem;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: rgba(255, 253, 248, 0.97);
	border-bottom: 1px solid var(--mhs-border);
	box-shadow: 0 2px 14px rgba(33, 29, 22, 0.05);
}

.site-main,
.site-footer-inner,
.page-band-inner {
	width: min(1140px, calc(100% - 2rem));
	margin-inline: auto;
}

.header-inner {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	max-width: 1200px;
	margin: 0 auto;
	padding: 12px 20px 10px;
	gap: 0.65rem;
}

.site-branding {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	flex: 0 0 auto;
	min-width: 0;
	max-width: 100%;
	text-align: center;
}

.site-title {
	display: inline-flex;
	align-items: center;
	color: var(--mhs-heading);
	font-size: 1.18rem;
	font-weight: 800;
	line-height: 1;
	text-decoration: none;
}

.site-title:hover {
	color: var(--mhs-rust);
}

.custom-logo-link {
	display: inline-flex;
	align-items: center;
	line-height: 1;
}

.custom-logo,
.site-branding img {
	display: block;
	max-height: 60px;
	width: auto;
	max-width: min(18rem, 100%);
}

.site-description {
	margin: 0.24rem 0 0;
	color: var(--mhs-muted);
	font-size: 0.9rem;
	line-height: 1.35;
}

.main-navigation {
	display: flex;
	width: 100%;
	flex: 0 1 auto;
	align-items: center;
	justify-content: center;
	min-width: 0;
}

.menu-toggle {
	display: none;
	align-items: center;
	gap: 0.45rem;
	min-height: 2.75rem;
	border: 2px solid var(--mhs-green);
	border-radius: var(--mhs-radius);
	background: #fff;
	color: var(--mhs-green-dark);
	font-weight: 800;
	padding: 0.5rem 0.75rem;
	cursor: pointer;
}

.menu-toggle-icon {
	position: relative;
	display: inline-block;
	width: 1.1rem;
	height: 0.8rem;
	border-top: 3px solid currentColor;
	border-bottom: 3px solid currentColor;
}

.menu-toggle-icon::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	border-top: 3px solid currentColor;
	transform: translateY(-50%);
}

.primary-menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.35rem 1.15rem;
	margin: 0;
	padding: 0;
	list-style: none;
	max-width: 100%;
	min-width: 0;
}

.primary-menu li {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
}

.primary-menu a {
	display: flex;
	align-items: center;
	border-radius: var(--mhs-radius);
	color: var(--mhs-heading);
	font-size: clamp(0.86rem, 0.9vw, 0.98rem);
	font-weight: 800;
	line-height: 1;
	padding: 0.45rem 0.25rem;
	text-decoration: none;
	white-space: nowrap;
}

@media (max-width: 1180px) {
	.site-branding {
		max-width: 100%;
	}

	.main-navigation {
		justify-content: center;
	}
}

@media (max-width: 760px) {
	.menu-toggle {
		display: inline-flex;
	}

	.primary-menu {
		display: none;
		width: auto;
	}

	.main-navigation.is-open .primary-menu {
		display: grid;
		grid-template-columns: 1fr;
		position: absolute;
		left: 0;
		right: 0;
		top: 100%;
		z-index: 60;
		gap: 0.35rem;
		border: 1px solid var(--mhs-border);
		border-radius: var(--mhs-radius);
		background: var(--mhs-panel);
		box-shadow: var(--mhs-shadow);
		padding: 0.5rem;
	}

	.primary-menu a {
		border: 1px solid var(--mhs-border);
		background: #fff;
		padding: 0.75rem 0.85rem;
		line-height: 1.2;
		white-space: normal;
	}
}

.primary-menu a:hover,
.primary-menu .current-menu-item > a,
.primary-menu .current_page_item > a {
	background: var(--mhs-bg-soft);
	color: var(--mhs-green-dark);
}

.site-main {
	padding: 2.4rem 0 3.2rem;
}

.hero {
	position: relative;
	background:
		linear-gradient(90deg, rgba(24, 63, 53, 0.94), rgba(24, 63, 53, 0.78) 52%, rgba(74, 51, 36, 0.68)),
		url("assets/images/heritage-placeholder.svg") center/cover;
	color: #fff;
}

.hero::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 0.45rem;
	background: linear-gradient(90deg, var(--mhs-gold), var(--mhs-rust), var(--mhs-green));
}

.hero .page-band-inner {
	min-height: clamp(25rem, 58vh, 36rem);
	display: grid;
	align-content: end;
	padding: 5.5rem 0 4rem;
}

.hero-kicker,
.section-kicker {
	margin: 0 0 0.55rem;
	color: var(--mhs-rust);
	font-size: 0.84rem;
	font-weight: 900;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.hero-kicker {
	color: var(--mhs-gold-soft);
}

.hero h1 {
	max-width: 840px;
	margin: 0;
	color: #fff;
	font-size: clamp(2.45rem, 7vw, 5rem);
	line-height: 1.02;
}

.hero p:not(.hero-kicker) {
	max-width: 720px;
	margin: 1rem 0 0;
	font-family: Arial, Helvetica, sans-serif;
	font-size: clamp(1.08rem, 2vw, 1.25rem);
	line-height: 1.55;
}

.button-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

.button,
.wp-block-button__link,
button[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.8rem;
	border: 2px solid var(--mhs-green);
	border-radius: var(--mhs-radius);
	background: var(--mhs-green);
	color: #fff;
	font-weight: 900;
	line-height: 1.2;
	padding: 0.75rem 1rem;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.button:hover,
.wp-block-button__link:hover,
button[type="submit"]:hover {
	background: var(--mhs-green-dark);
	border-color: var(--mhs-green-dark);
	color: #fff;
}

.button.secondary {
	background: #fff;
	color: var(--mhs-green-dark);
}

.button.secondary:hover {
	background: var(--mhs-bg-soft);
	color: var(--mhs-green-dark);
}

.section {
	padding: 2.75rem 0;
}

.section + .section {
	border-top: 1px solid rgba(216, 205, 184, 0.7);
}

.section-alt {
	width: 100vw;
	margin-left: calc(50% - 50vw);
	padding-inline: max(1rem, calc((100vw - 1140px) / 2));
	background: var(--mhs-bg-soft);
}

.section-title {
	margin: 0 0 0.65rem;
	color: var(--mhs-heading);
}

.section-intro {
	max-width: var(--mhs-measure);
	margin: 0 0 1.5rem;
	color: var(--mhs-muted);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 1.04rem;
	line-height: 1.6;
}

.welcome-layout,
.section-heading-row,
.cta-panel {
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.35fr);
	gap: 1.5rem;
	align-items: end;
}

.welcome-section {
	padding-top: 0.5rem;
}

.grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.15rem;
}

.archive-grid {
	align-items: stretch;
}

.card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--mhs-panel);
	border: 1px solid var(--mhs-border);
	border-radius: var(--mhs-radius);
	box-shadow: var(--mhs-shadow);
	overflow: clip;
}

.card:hover {
	border-color: #c8b48d;
}

.card a {
	text-decoration: none;
}

.card-image {
	position: relative;
	aspect-ratio: 4 / 3;
	background:
		linear-gradient(135deg, rgba(184, 139, 51, 0.22), rgba(40, 88, 73, 0.18)),
		var(--mhs-bg-soft);
	overflow: hidden;
}

.card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 180ms ease;
}

.card:hover .card-image img {
	transform: scale(1.025);
}

.card-image-placeholder {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(150deg, rgba(24, 63, 53, 0.14), rgba(184, 139, 51, 0.28)),
		url("assets/images/heritage-placeholder.svg") center/cover;
}

.card-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 1rem;
}

.card-kicker,
.entry-meta,
.taxonomy-list,
.mhs-form-note,
.card-meta-line {
	color: var(--mhs-muted);
	font-size: 0.9rem;
	line-height: 1.45;
}

.card-kicker {
	margin-bottom: 0.25rem;
	color: var(--mhs-rust);
	font-weight: 900;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.card h2,
.card h3 {
	margin: 0 0 0.45rem;
	font-size: 1.28rem;
	line-height: 1.25;
}

.card h2 a,
.card h3 a {
	color: var(--mhs-heading);
}

.card h2 a:hover,
.card h3 a:hover {
	color: var(--mhs-rust);
}

.card-meta-line {
	margin: 0 0 0.65rem;
	font-weight: 700;
}

.taxonomy-list {
	margin-top: auto;
	padding-top: 0.3rem;
}

.taxonomy-list a {
	display: inline-block;
	margin: 0.1rem 0.15rem 0.1rem 0;
	border-radius: 999px;
	background: var(--mhs-bg-soft);
	color: var(--mhs-green-dark);
	padding: 0.16rem 0.45rem;
	text-decoration: none;
}

.taxonomy-list a:hover {
	background: var(--mhs-gold-soft);
	color: var(--mhs-brown);
}

.archive-header {
	margin-bottom: 1.5rem;
}

.archive-hero,
.single-header {
	border-left: 6px solid var(--mhs-gold);
	background: linear-gradient(90deg, var(--mhs-panel), rgba(255, 253, 248, 0));
	padding: 1.15rem 0 1.15rem 1.25rem;
}

.archive-header h1 {
	max-width: 900px;
}

.archive-tools {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0.75rem;
	align-items: end;
	margin: 1rem 0 1.75rem;
}

.search-field,
.mhs-form input,
.mhs-form select,
.mhs-form textarea {
	width: 100%;
	border: 2px solid var(--mhs-border);
	border-radius: var(--mhs-radius);
	background: #fff;
	color: var(--mhs-ink);
	padding: 0.76rem;
}

.search-field:hover,
.mhs-form input:hover,
.mhs-form select:hover,
.mhs-form textarea:hover {
	border-color: #bcae91;
}

.content-layout {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(17rem, 0.82fr);
	gap: 2rem;
	align-items: start;
}

.entry-content,
.sidebar-box,
.mhs-form {
	background: var(--mhs-panel);
	border: 1px solid var(--mhs-border);
	border-radius: var(--mhs-radius);
	box-shadow: var(--mhs-shadow);
	padding: clamp(1rem, 2.5vw, 1.6rem);
}

.entry-content {
	max-width: 100%;
}

.entry-content > * {
	max-width: var(--mhs-measure);
}

.entry-content > .alignwide,
.entry-content > .wp-block-gallery,
.entry-content > figure,
.entry-content > .wp-block-image,
.entry-content > .wp-block-embed,
.entry-content > .wp-block-audio,
.entry-content > .wp-block-video {
	max-width: 100%;
}

.entry-content > *:first-child,
.sidebar-box > *:first-child,
.mhs-form > *:first-child {
	margin-top: 0;
}

.entry-content > *:last-child,
.sidebar-box > *:last-child,
.mhs-form > *:last-child {
	margin-bottom: 0;
}

.entry-content img {
	border-radius: var(--mhs-radius);
}

.entry-content blockquote {
	margin: 1.35rem 0;
	border-left: 5px solid var(--mhs-gold);
	background: var(--mhs-bg-soft);
	padding: 1rem 1.15rem;
	font-size: 1.08rem;
}

.sidebar-box {
	position: sticky;
	top: 6rem;
}

.sidebar-box h2 {
	font-size: 1.25rem;
}

.meta-list {
	display: grid;
	gap: 0.55rem;
	margin: 0;
}

.meta-list div {
	border-bottom: 1px solid var(--mhs-border);
	padding-bottom: 0.58rem;
}

.meta-list div:last-child {
	border-bottom: 0;
	padding-bottom: 0;
}

.meta-list dt {
	color: var(--mhs-heading);
	font-family: Arial, Helvetica, sans-serif;
	font-weight: 900;
}

.meta-list dd {
	margin: 0.05rem 0 0;
}

.related-items {
	margin-top: 1rem;
}

.content-directory,
.directory-section {
	display: grid;
	gap: 1rem;
}

.directory-section {
	padding: 2rem 0;
	border-top: 1px solid var(--mhs-border);
}

.directory-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.directory-view-all,
.read-more {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: 900;
}

.directory-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1rem;
}

.directory-card {
	display: flex;
	flex-direction: column;
	overflow: clip;
	border: 1px solid var(--mhs-border);
	border-radius: var(--mhs-radius);
	background: var(--mhs-panel);
	box-shadow: var(--mhs-shadow);
}

.directory-card-image {
	display: block;
	aspect-ratio: 4 / 3;
	background: var(--mhs-bg-soft);
	overflow: hidden;
}

.directory-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.directory-card-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 1rem;
}

.directory-card-body h3 {
	margin-bottom: 0.45rem;
	font-size: 1.18rem;
}

.directory-card-body .read-more {
	margin-top: auto;
}

.mhs-form {
	max-width: 860px;
}

.mhs-form h2 {
	margin-bottom: 0.4rem;
}

.mhs-form label {
	display: block;
	margin-top: 1rem;
	color: var(--mhs-heading);
	font-family: Arial, Helvetica, sans-serif;
	font-weight: 900;
}

.mhs-form fieldset {
	border: 1px solid var(--mhs-border);
	border-radius: var(--mhs-radius);
	margin: 1.25rem 0;
	padding: 1rem;
	background: #fffaf0;
}

.mhs-form legend {
	padding: 0 0.35rem;
	color: var(--mhs-heading);
	font-family: Arial, Helvetica, sans-serif;
	font-weight: 900;
}

.mhs-honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.mhs-form textarea {
	min-height: 10rem;
	resize: vertical;
}

.mhs-form input[type="checkbox"] {
	width: auto;
	margin-right: 0.45rem;
	transform: scale(1.18);
}

.mhs-form input[type="file"] {
	padding: 0.55rem;
	background: #fff;
}

.notice {
	border-left: 6px solid var(--mhs-green);
	border-radius: var(--mhs-radius);
	background: #eaf2ed;
	color: var(--mhs-green-dark);
	padding: 0.85rem 1rem;
	margin: 1rem 0;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: 700;
}

.notice[role="alert"] {
	border-left-color: var(--mhs-danger);
	background: #f9e8e4;
	color: var(--mhs-danger);
}

.cta-panel {
	align-items: center;
	border: 1px solid #cdb274;
	border-radius: var(--mhs-radius);
	background:
		linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(234, 216, 170, 0.8)),
		var(--mhs-panel);
	box-shadow: var(--mhs-shadow);
	padding: clamp(1.25rem, 3vw, 2rem);
}

.cta-panel p {
	max-width: var(--mhs-measure);
}

.site-footer {
	background: var(--mhs-brown);
	color: #fff;
}

.site-footer a {
	color: #fff;
}

.site-footer-inner {
	display: grid;
	grid-template-columns: 1.4fr 1fr;
	gap: 1.5rem;
	padding: 2.2rem 0;
}

.site-footer h2 {
	color: #fff;
}

.footer-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 0.8rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-family: Arial, Helvetica, sans-serif;
}

.pagination {
	margin-top: 1.5rem;
}

.pagination .page-numbers {
	display: inline-block;
	min-width: 2.25rem;
	margin: 0.15rem;
	padding: 0.45rem 0.65rem;
	border: 1px solid var(--mhs-border);
	border-radius: var(--mhs-radius);
	background: #fff;
	text-align: center;
	text-decoration: none;
}

.pagination .current {
	background: var(--mhs-green);
	color: #fff;
}

@media (max-width: 1020px) {
	.grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.directory-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.content-layout,
	.welcome-layout,
	.section-heading-row,
	.cta-panel {
		grid-template-columns: 1fr;
	}

	.sidebar-box {
		position: static;
	}
}

@media (max-width: 760px) {
	html {
		font-size: 17px;
	}

	.site-header {
		position: static;
	}

	.site-branding {
		max-width: calc(100% - 7rem);
	}

	.hero .page-band-inner {
		min-height: 28rem;
		padding: 4rem 0 3rem;
	}

	.button,
	.wp-block-button__link,
	button[type="submit"] {
		width: 100%;
	}

	.grid,
	.directory-grid,
	.site-footer-inner,
	.archive-tools {
		grid-template-columns: 1fr;
	}

	.directory-section-header {
		align-items: flex-start;
		flex-direction: column;
	}

	.archive-hero,
	.single-header {
		padding-left: 1rem;
	}

	.entry-content,
	.sidebar-box,
	.mhs-form {
		padding: 1rem;
	}
}

@media (max-width: 420px) {
	.site-main,
	.site-footer-inner,
	.page-band-inner {
		width: min(100% - 1rem, 1140px);
	}

	.hero h1 {
		font-size: 2.25rem;
	}

	.card-body {
		padding: 0.9rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}

@media print {
	:root {
		--mhs-ink: #000;
		--mhs-heading: #000;
		--mhs-muted: #333;
	}

	* {
		box-shadow: none !important;
		text-shadow: none !important;
	}

	body {
		background: #fff;
		color: #000;
		font-size: 12pt;
		line-height: 1.45;
	}

	.site-header,
	.site-footer,
	.main-navigation,
	.button-row,
	.archive-tools,
	.sidebar-box,
	.related-items,
	.cta-section,
	.mhs-form,
	.pagination {
		display: none !important;
	}

	.site-main,
	.header-inner,
	.page-band-inner {
		width: 100%;
		margin: 0;
		padding: 0;
	}

	.archive-header,
	.single-header,
	.entry-content {
		border: 0;
		background: #fff;
		padding: 0;
	}

	.entry-content {
		max-width: none;
	}

	.entry-content > * {
		max-width: none;
	}

	a {
		color: #000;
		text-decoration: underline;
	}

	a[href^="http"]::after {
		content: " (" attr(href) ")";
		font-size: 10pt;
	}

	img {
		max-height: 5in;
		page-break-inside: avoid;
	}

	h1,
	h2,
	h3 {
		page-break-after: avoid;
	}
}
