/*
 * Lucid: main stylesheet (every view).
 *
 * Colours, fonts and widths come from the --lc-* custom properties that
 * inc/presets.php prints inline before this file. Fallback values here equal
 * the "Home Improvement" preset so the page is still correct if they are missing.
 *
 * Contents
 *  1. Reset & base
 *  2. Utilities
 *  3. Layout
 *  4. Header & navigation
 *  5. Buttons, chips, forms
 *  6. Cards & grids
 *  7. Page headers, sections, empty states
 *  8. Breadcrumbs, pagination
 *  9. Footer
 * 10. Ad slots
 * 11. Motion & print
 */

/* 1. Reset & base ---------------------------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-top: var(--lc-scroll-offset, 1rem);
}

:root:has(.has-sticky-header) {
	--lc-scroll-offset: 5.5rem;
}

body {
	margin: 0;
	background: var(--lc-bg, #faf8f4);
	color: var(--lc-text, #231f1a);
	font-family: var(--lc-font-body, system-ui, sans-serif);
	line-height: 1.6;
	overflow-wrap: break-word;
}

img,
svg,
video,
iframe {
	max-width: 100%;
}

img {
	height: auto;
}

a {
	color: var(--lc-link, #2f6b4f);
	text-underline-offset: 0.18em;
}

a:hover {
	color: var(--lc-link-hover, #1f4a36);
}

:focus-visible {
	outline: 3px solid var(--lc-focus, #2f6b4f);
	outline-offset: 2px;
	border-radius: 2px;
}

h1,
h2,
h3,
h4 {
	font-family: var(--lc-font-head, inherit);
	line-height: 1.25;
	text-wrap: balance;
}

/* 2. Utilities ------------------------------------------------------------- */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	position: static !important;
	width: auto;
	height: auto;
	margin: 0;
	overflow: visible;
	clip-path: none;
}

.skip-link {
	position: absolute;
	z-index: 100;
	top: -5rem;
	left: 0.75rem;
	padding: 0.75rem 1rem;
	background: var(--lc-text);
	color: var(--lc-bg);
	font-weight: 600;
	border-radius: 0 0 var(--lc-radius, 6px) var(--lc-radius, 6px);
}

.skip-link:focus {
	top: 0;
}

/* 3. Layout ---------------------------------------------------------------- */
.wrap {
	width: 100%;
	max-width: var(--lc-wrap, 1200px);
	margin-inline: auto;
	padding-inline: 1rem;
}

@media (min-width: 48em) {
	.wrap {
		padding-inline: 1.5rem;
	}
}

.site-main:focus {
	outline: none;
}

.layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2.5rem;
	padding-block: 1.5rem 3rem;
}

@media (min-width: 64em) {
	.layout--sidebar {
		grid-template-columns: minmax(0, 1fr) 19rem;
		gap: 3rem;
	}
}

.sidebar > * + * {
	margin-top: 2rem;
}

.widget-title {
	margin: 0 0 0.75rem;
	font-size: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.sidebar ul {
	margin: 0;
	padding-left: 1.1rem;
}

/* 4. Header & navigation --------------------------------------------------- */
.topbar {
	background: var(--lc-surface-alt);
	border-bottom: 1px solid var(--lc-border);
	font-size: 0.875rem;
}

.site-header {
	background: var(--lc-surface);
	border-bottom: 1px solid var(--lc-border);
}

.has-sticky-header .site-header {
	position: sticky;
	top: 0;
	z-index: 50;
}

.admin-bar.has-sticky-header .site-header {
	top: 32px;
}

.site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem 1rem;
	min-height: 3.5rem;
	padding-block: 0.5rem;
}

.site-branding {
	margin-inline-end: auto;
	min-width: 0;
}

.site-title {
	margin: 0;
	font-family: var(--lc-font-head);
	font-size: 1.3rem;
	font-weight: 700;
	line-height: 1.2;
}

.site-title a {
	color: var(--lc-text);
	text-decoration: none;
}

.custom-logo-link {
	display: inline-block;
	line-height: 0;
}

.custom-logo {
	width: auto;
	max-height: 2.75rem;
}

.site-header__actions {
	display: flex;
	gap: 0.25rem;
}

.icon-button {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding: 0.4rem 0.6rem;
	border: 1px solid transparent;
	border-radius: var(--lc-radius, 6px);
	background: transparent;
	color: var(--lc-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.icon-button:hover,
.icon-button[aria-expanded="true"] {
	border-color: var(--lc-border);
	background: var(--lc-surface-alt);
}

.icon {
	flex: none;
}

/* On small screens the label hides visually but remains the accessible name. */
.icon-button__text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.no-js .nav-toggle,
.no-js .search-toggle,
.no-js .submenu-toggle {
	display: none;
}

/* Primary navigation (mobile first: collapsed when JS is available). */
.primary-nav,
.search-panel {
	flex-basis: 100%;
	order: 5;
}

.js .primary-nav,
.js .search-panel {
	display: none;
}

.js .primary-nav.is-open,
.js .search-panel.is-open {
	display: block;
}

.menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.menu--primary a {
	display: flex;
	align-items: center;
	min-height: 2.75rem;
	padding: 0.4rem 0.25rem;
	color: var(--lc-text);
	font-weight: 500;
	text-decoration: none;
}

.menu--primary a:hover {
	text-decoration: underline;
	text-decoration-thickness: 2px;
}

/* Current location: weight AND underline, never colour alone. */
.menu--primary .current-menu-item > a,
.menu--primary .current-menu-ancestor > a,
.menu--primary .current-post-ancestor > a,
.menu--primary a[aria-current="page"] {
	font-weight: 700;
	box-shadow: inset 0 -3px 0 var(--lc-accent);
}

.menu-item-has-children {
	position: relative;
}

.menu-item-has-children > a {
	display: inline-flex;
}

.submenu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--lc-text);
	cursor: pointer;
	vertical-align: top;
}

.submenu-toggle svg {
	transition: transform 0.15s ease;
}

.is-open > .submenu-toggle svg {
	transform: rotate(180deg);
}

.sub-menu {
	margin: 0;
	padding: 0 0 0 1rem;
	list-style: none;
}

.js .sub-menu {
	display: none;
}

.js .is-open > .sub-menu {
	display: block;
}

.search-panel {
	padding-block: 0.5rem 0.75rem;
}

@media (min-width: 60em) {
	.primary-nav {
		order: 2;
		flex-basis: auto;
	}

	.site-header__actions {
		order: 3;
	}

	.search-panel {
		order: 5;
	}

	.js .primary-nav {
		display: block;
	}

	.nav-toggle {
		display: none;
	}

	.icon-button__text {
		position: static;
		width: auto;
		height: auto;
		clip-path: none;
	}

	.menu--primary {
		display: flex;
		flex-wrap: wrap;
		gap: 0 0.5rem;
	}

	.menu--primary > li > a {
		padding-inline: 0.6rem;
	}

	.sub-menu {
		position: absolute;
		z-index: 60;
		top: 100%;
		left: 0;
		min-width: 14rem;
		padding: 0.4rem;
		background: var(--lc-surface);
		border: 1px solid var(--lc-border);
		border-radius: var(--lc-radius, 6px);
		box-shadow: 0 8px 24px rgb(0 0 0 / 0.1);
	}

	.js .sub-menu {
		display: none;
	}

	/* Open by button (JS) or by hover/focus (progressive enhancement). */
	.js .is-open > .sub-menu,
	.menu-item-has-children:hover > .sub-menu,
	.menu-item-has-children:focus-within > .sub-menu {
		display: block;
	}

	.no-js .sub-menu {
		display: none;
	}

	.no-js .menu-item-has-children:hover > .sub-menu,
	.no-js .menu-item-has-children:focus-within > .sub-menu {
		display: block;
	}
}

.menu--inline {
	display: flex;
	flex-wrap: wrap;
	gap: 0 1.25rem;
}

.menu--inline a {
	display: inline-block;
	padding-block: 0.5rem;
	color: var(--lc-muted);
}

/* 5. Buttons, chips, forms ------------------------------------------------- */
.button,
.search-form__submit,
.comment-form .submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.75rem;
	padding: 0.55rem 1.1rem;
	border: 2px solid var(--lc-accent);
	border-radius: var(--lc-radius, 6px);
	background: var(--lc-accent);
	color: var(--lc-on-accent, #fff);
	font: inherit;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	cursor: pointer;
}

.button:hover,
.search-form__submit:hover,
.comment-form .submit:hover {
	color: var(--lc-on-accent, #fff);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.button--ghost {
	background: transparent;
	color: var(--lc-link);
}

.button--ghost:hover {
	color: var(--lc-link-hover);
}

.search-form {
	display: flex;
	gap: 0.5rem;
	max-width: 32rem;
}

.search-form__input,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea,
.post-password-form input[type="password"] {
	width: 100%;
	min-height: 2.75rem;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--lc-muted);
	border-radius: var(--lc-radius, 6px);
	background: var(--lc-surface);
	color: var(--lc-text);
	font: inherit;
}

.search-form__input {
	flex: 1;
	min-width: 0;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.chips a,
.chip {
	display: inline-flex;
	align-items: center;
	min-height: 2.5rem;
	padding: 0.3rem 0.9rem;
	border: 1px solid var(--lc-border);
	border-radius: 999px;
	background: var(--lc-surface);
	color: var(--lc-text);
	font-weight: 500;
	text-decoration: none;
}

.chips a:hover,
.chip:hover {
	border-color: var(--lc-accent);
	color: var(--lc-text);
	text-decoration: underline;
}

.chips .current-menu-item > a,
.chips a[aria-current="page"] {
	font-weight: 700;
	border-color: var(--lc-accent);
	box-shadow: inset 0 -3px 0 var(--lc-accent);
}

.label {
	display: inline-block;
	color: var(--lc-link);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	text-decoration: none;
}

a.label:hover {
	text-decoration: underline;
}

/* 6. Cards & grids --------------------------------------------------------- */
.card-grid {
	display: grid;
	gap: 1.5rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}

.card-grid--rows {
	grid-template-columns: minmax(0, 1fr);
}

.card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--lc-surface);
	border: 1px solid var(--lc-border);
	border-radius: var(--lc-radius, 6px);
	overflow: hidden;
}

.card:focus-within {
	outline: 3px solid var(--lc-focus);
	outline-offset: 2px;
}

.card__title a:focus-visible {
	outline: none;
}

.card__media {
	aspect-ratio: 16 / 10;
	background: var(--lc-surface-alt);
	overflow: hidden;
}

.card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.card__fallback {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	background: var(--lc-accent-soft);
	color: var(--lc-link);
	font-family: var(--lc-font-head);
	font-size: 2.5rem;
	font-weight: 700;
}

.card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.4rem;
	padding: 1rem 1.1rem 1.15rem;
}

.card__kicker,
.card__meta,
.card__excerpt {
	margin: 0;
}

.card__title {
	margin: 0;
	font-size: 1.15rem;
	line-height: 1.3;
}

.card__title a {
	color: var(--lc-text);
	text-decoration: none;
}

/* Whole card is clickable through the title link (one link, one tab stop). */
.card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.card:hover .card__title a {
	text-decoration: underline;
	text-decoration-thickness: 2px;
}

.card__excerpt {
	color: var(--lc-muted);
	font-size: 0.95rem;
}

.card__meta {
	margin-top: auto;
	padding-top: 0.25rem;
	color: var(--lc-muted);
	font-size: 0.85rem;
}

@media (min-width: 40em) {
	.card--row {
		flex-direction: row;
	}

	.card--row .card__media {
		flex: 0 0 13rem;
		aspect-ratio: auto;
		min-height: 100%;
	}
}

@media (min-width: 48em) {
	.card--featured {
		grid-column: 1 / -1;
		flex-direction: row;
	}

	.card--featured .card__media {
		flex: 0 0 52%;
		aspect-ratio: auto;
		min-height: 18rem;
	}

	.card--featured .card__body {
		justify-content: center;
		padding: 1.75rem;
	}

	.card--featured .card__title {
		font-size: 1.65rem;
	}

	.card--featured .card__excerpt {
		font-size: 1.05rem;
	}
}

/* 7. Page headers, sections, empty states ---------------------------------- */
.page-header {
	max-width: var(--lc-wide, 56rem);
	padding-block: 0.5rem 1.5rem;
}

.page-header__eyebrow {
	margin: 0 0 0.25rem;
	color: var(--lc-link);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.page-header__title {
	margin: 0;
	font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
}

.page-header__description {
	margin: 0.75rem 0 0;
	color: var(--lc-muted);
	font-size: 1.0625rem;
}

.page-header__description > :first-child {
	margin-top: 0;
}

.page-header__description > :last-child {
	margin-bottom: 0;
}

.subtopics {
	margin-bottom: 1.5rem;
}

.home-intro {
	padding-block: 2.5rem 1.5rem;
	background: var(--lc-surface-alt);
	border-bottom: 1px solid var(--lc-border);
}

.home-intro__title {
	max-width: var(--lc-wide, 56rem);
	margin: 0;
	font-size: clamp(1.9rem, 1.4rem + 2.2vw, 3rem);
	line-height: 1.15;
}

.home-intro__text {
	max-width: 42rem;
	margin: 0.75rem 0 0;
	font-size: 1.15rem;
	color: var(--lc-muted);
}

.home-intro__actions {
	margin: 1.25rem 0 0;
}

.home-topics {
	padding-block: 1.5rem 0;
}

.home-section {
	padding-block: 2rem 0.5rem;
}

.section-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.25rem 1rem;
	margin-bottom: 1rem;
}

.section-title {
	margin: 0 0 1rem;
	font-size: 1.5rem;
}

.section-head .section-title {
	margin: 0;
}

.section-title--small {
	margin-bottom: 0.6rem;
	font-size: 0.85rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--lc-muted);
}

.section-link {
	font-weight: 600;
}

.section-more {
	margin: 1.5rem 0 0;
}

.empty-state {
	max-width: var(--lc-measure, 40rem);
	padding-block: 1rem;
}

.empty-state__title {
	margin-top: 0;
}

.empty-state__subtitle {
	margin: 1.75rem 0 0.75rem;
	font-size: 1rem;
}

/* 8. Breadcrumbs, pagination ----------------------------------------------- */
.breadcrumbs {
	margin-bottom: 1.25rem;
	font-size: 0.875rem;
}

.breadcrumbs__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.15rem 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--lc-muted);
}

.breadcrumbs__item + .breadcrumbs__item::before {
	content: "/";
	content: "/" / "";
	margin-inline-end: 0.5rem;
}

.breadcrumbs a {
	color: var(--lc-muted);
}

.breadcrumbs [aria-current="page"] {
	color: var(--lc-text);
}

.pagination {
	margin-top: 2.5rem;
}

.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding: 0.25rem 0.8rem;
	border: 1px solid var(--lc-border);
	border-radius: var(--lc-radius, 6px);
	background: var(--lc-surface);
	color: var(--lc-text);
	font-weight: 500;
	text-decoration: none;
}

a.page-numbers:hover {
	border-color: var(--lc-accent);
	text-decoration: underline;
}

.page-numbers.current {
	border-color: var(--lc-accent);
	background: var(--lc-accent);
	color: var(--lc-on-accent);
	font-weight: 700;
}

.page-numbers.dots {
	border-color: transparent;
	background: transparent;
}

/* 9. Footer ---------------------------------------------------------------- */
.site-footer {
	margin-top: 3rem;
	background: var(--lc-surface-alt);
	border-top: 1px solid var(--lc-border);
}

.footer-grid {
	display: grid;
	gap: 2rem;
	grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
	padding-block: 2.5rem 1rem;
}

.footer-title {
	margin: 0 0 0.5rem;
	font-family: var(--lc-font-head);
	font-size: 1.2rem;
	font-weight: 700;
}

.footer-text {
	margin: 0;
	max-width: 24rem;
	color: var(--lc-muted);
}

.footer-heading {
	margin: 0 0 0.6rem;
	font-size: 0.85rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--lc-muted);
}

.footer-menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.footer-menu a {
	display: inline-block;
	padding-block: 0.3rem;
	color: var(--lc-text);
}

.footer-bottom {
	border-top: 1px solid var(--lc-border);
	font-size: 0.875rem;
	color: var(--lc-muted);
}

.copyright {
	margin: 0;
	padding-block: 1rem;
}

/* 10. Ad slots -------------------------------------------------------------
 * Rendered only when enabled AND filled (see inc/ads.php). Nothing here
 * clips, overlays or sticks: the provider's own sizing is respected. Space is
 * reserved only when the owner set a known height in the Customizer.
 */
.ad-slot {
	clear: both;
	max-width: 100%;
	margin-block: 2.25rem;
	padding-block: 0.75rem;
	border-block: 1px solid var(--lc-border);
	text-align: center;
}

.ad-slot__label {
	margin: 0 0 0.5rem;
	color: var(--lc-muted);
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ad-slot__body {
	display: flex;
	justify-content: center;
}

.ad-slot--reserved .ad-slot__body {
	min-height: var(--lc-ad-reserve);
}

/* 11. Motion & print ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}

@media print {
	.skip-link,
	.topbar,
	.site-header,
	.site-footer,
	.ad-slot,
	.sidebar,
	.comments,
	.related,
	.post-navigation,
	.pagination {
		display: none !important;
	}

	body {
		background: #fff;
		color: #000;
	}
}
