/*!
 * Helio child theme — design & UX refinements (the "quick wins").
 * Pure CSS overrides on top of TT4 + the ported templates; all of it is
 * baked into the static export as-is.
 */

/* ================================================================== *
 * 1. Contrast tokens (light mode)
 *    Secondary text (post meta, captions, taglines) sat at the AA
 *    boundary (#636363 on #f9f9f9 ≈ 4.6:1). Darken to a comfortable 7:1.
 * ================================================================== */
:root {
	--wp--preset--color--contrast-2: #575757;
}

/* ================================================================== *
 * 2. Focus visibility (keyboard users)
 * ================================================================== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 2px;
}

/* ================================================================== *
 * 3. Captions — readable, left-aligned, sized like small print
 * ================================================================== */
.wp-block-image figcaption,
.wp-block-post-featured-image figcaption,
figure figcaption {
	font-size: 0.875rem;
	line-height: 1.45;
	color: var(--wp--preset--color--contrast-2);
	text-align: left;
}

/* ================================================================== *
 * 4. Pagination — the current page must be the strongest item
 * ================================================================== */
.wp-block-query-pagination .page-numbers.current {
	font-weight: 700;
	text-decoration: none;
}
.wp-block-query-pagination .page-numbers {
	font-size: 0.95rem;
	min-width: 1.9em;
	min-height: 1.9em;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* ================================================================== *
 * 5. Post navigation — slightly louder so it isn't lost
 * ================================================================== */
.wp-block-post-navigation-link a {
	font-weight: 500;
}

/* ================================================================== *
 * 6. Homepage grid — kill the dead right gutter and rebalance
 *    (template columns are 60% / 20% sidebar / 16% empty, all with
 *    inline flex-basis — hence the !important below)
 * ================================================================== */
@media (min-width: 782px) {
	.home .wp-site-blocks > .wp-block-columns.alignwide {
		column-gap: clamp(2rem, 3.5vw, 3.5rem);
	}
	.home .wp-site-blocks > .wp-block-columns.alignwide > .wp-block-column:nth-child(1) {
		flex-basis: 0 !important; /* was 60% (inline) */
		flex-grow: 1;
		min-width: 0;
	}
	.home .wp-site-blocks > .wp-block-columns.alignwide > .wp-block-column:nth-child(2) {
		flex-basis: 340px !important; /* was 20% (inline); sidebar widgets are 340px */
		flex-grow: 0;
		flex-shrink: 0;
		min-width: 0;
	}
	.home .wp-site-blocks > .wp-block-columns.alignwide > .wp-block-column:nth-child(3) {
		display: none; /* dead 16% gutter column */
	}
}

/* Featured images on the listing: 16:9 keeps three posts from
 * becoming ~2100px of scroll. (Single posts keep the full image.) */
.home .wp-block-post-featured-image img,
.blog .wp-block-post-featured-image img,
.archive .wp-block-post-featured-image img {
	aspect-ratio: 16 / 9;
	object-fit: cover;
	width: 100%;
}

/* ================================================================== *
 * 7. Single post — one alignment system and a sane measure (~66ch)
 *    (title/images already sit in a 50% constrained column ≈620px;
 *    capping the body text at 42rem ≈672px keeps one visual system)
 * ================================================================== */
.single-post .wp-block-post-content {
	max-width: 42rem;
	margin-inline: auto;
}

/* ================================================================== *
 * 8. Mobile header — less red chrome, sane touch targets
 * ================================================================== */
@media (max-width: 600px) {
	header.wp-block-template-part .wp-block-paragraph {
		font-size: 0.85rem;
		line-height: 1.3;
	}
	header.wp-block-template-part .wp-block-site-title {
		font-size: 1.35rem;
	}
}
.wp-block-navigation__responsive-container-open {
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* ================================================================== *
 * 9. Header tools — GTranslate flags & toggle
 *    (the widget's own CSS forces display:block on its container,
 *    which neutralizes gap — hence the !important here)
 * ================================================================== */
header .gtranslate_wrapper {
	display: inline-flex !important;
	align-items: center;
	column-gap: 0.55rem !important; /* flags were touching — give them air */
}
header .gtranslate_wrapper a {
	line-height: 0;
	padding: 2px;
	border-radius: 3px;
}
header .gtranslate_wrapper a:focus-visible {
	outline-offset: 1px;
}

/* ================================================================== *
 * 10. Dark-mode fixes for hard-coded light surfaces
 * ================================================================== */

/* Rise/set widget frame (inline #f3f3f3) — make it a dark card. */
html[data-theme="dark"] .wp-dark-mode-ignore {
	background-color: #1c1c22 !important;
}

/* Search button: match the dark input instead of a white slab. */
html[data-theme="dark"] .wp-block-search__button {
	background-color: transparent;
	color: var(--wp--preset--color--contrast);
	border: 1px solid var(--wp--preset--color--contrast-3);
}
html[data-theme="dark"] .wp-block-search__button:hover,
html[data-theme="dark"] .wp-block-search__button:focus-visible {
	background-color: rgba(255, 255, 255, 0.08);
}

/* Footer band: keep some air under the last nav link. */
footer.wp-block-template-part .wp-block-group[style*="7c0c0c"] {
	padding-bottom: 2.1rem !important;
}

/* ================================================================== *
 * 11. Pagefind search UI (static export only) — theme integration
 * ================================================================== */
.pagefind-ui {
	--pagefind-ui-scale: 0.9;
	--pagefind-ui-primary: #111111;
	--pagefind-ui-text: #111111;
	--pagefind-ui-background: #ffffff;
	--pagefind-ui-border: #a4a4a4;
	--pagefind-ui-tag: #eeeeee;
	--pagefind-ui-border-width: 1px;
	--pagefind-ui-border-radius: 6px;
	--pagefind-ui-font: inherit;
}
html[data-theme="dark"] .pagefind-ui {
	--pagefind-ui-primary: #eceef2;
	--pagefind-ui-text: #eceef2;
	--pagefind-ui-background: #1c1c22;
	--pagefind-ui-border: #4e525c;
	--pagefind-ui-tag: #26262e;
}
