/*
Theme Name: Township
Theme URI: https://ai-govsolutions.com
Author: AI GovSolutions
Author URI: https://ai-govsolutions.com
Description: A block theme for a public-sector AI consultancy serving rural and regional agencies. Plain, structured and legible, with a survey-grid motif. WCAG 2.2 AA accessibility built in: tested contrast, visible focus, skip link, reduced-motion support, semantic landmarks, and a typeface designed for low-vision readers.
Requires at least: 6.6
Tested up to: 6.8
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: township
Tags: blog, one-column, grid-layout, accessibility-ready, block-patterns, full-site-editing, custom-colors, editor-style
*/

/* ---------- Base ---------- */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; }
::selection { background: var(--wp--preset--color--primary); color: var(--wp--preset--color--white); }

/* ---------- Focus ---------- */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
	border-radius: 2px;
}
.tws-dark :focus-visible { outline-color: var(--wp--preset--color--sky); }
.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--white);
	font-size: 1rem; font-weight: 700;
	padding: 0.9rem 1.25rem; top: 0.75rem; left: 0.75rem;
	text-decoration: underline; z-index: 100000;
	clip: auto; clip-path: none; height: auto; width: auto;
}

/* ---------- Links ---------- */
a { text-decoration-thickness: 0.08em; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 0.18em; }
.tws-dark a:not(.wp-block-button__link) { color: var(--wp--preset--color--sky); }

/* ---------- Header ---------- */
.tws-header { border-bottom: 3px solid var(--wp--preset--color--primary); background: var(--wp--preset--color--base); }
.tws-header .wp-block-site-title a { text-decoration: none; }
.tws-header .wp-block-site-title a:hover { text-decoration: underline; }
.tws-header .wp-block-navigation-item__content { padding: 0.6rem 0.15rem; text-decoration: none; border-bottom: 3px solid transparent; }
.tws-header .wp-block-navigation-item__content:hover,
.tws-header [aria-current="page"] { border-bottom-color: var(--wp--preset--color--primary); }
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
@media (min-width: 600px) { .wp-block-navigation__responsive-container-open:not(.always-shown) { display: none; } }
.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open,
.wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--navy); color: var(--wp--preset--color--base);
	padding: 1.25rem clamp(1.25rem, 5vw, 3rem);
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-family: var(--wp--preset--font-family--display); font-weight: 700; font-size: 1.6rem; padding-block: 0.5rem; color: var(--wp--preset--color--base);
}
.wp-block-navigation__responsive-container.is-menu-open :focus-visible { outline-color: var(--wp--preset--color--sky); }

/* ---------- Labels ---------- */
.tws-label {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.875rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
	color: var(--wp--preset--color--muted);
	margin-bottom: 0;
}
.tws-label::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; background: var(--wp--preset--color--primary); margin-right: 0.7em; }
.tws-dark .tws-label { color: var(--wp--preset--color--fine); }
.tws-dark .tws-label::before { background: var(--wp--preset--color--sky); }

/* ---------- Hero with survey grid ---------- */
.tws-hero { position: relative; overflow: hidden; padding-block: clamp(4rem, 10vw, 8rem); }
.tws-hero > * { position: relative; z-index: 1; }
.tws-hero::after {
	content: ""; position: absolute; z-index: 0; inset: 0 0 0 auto; width: min(52%, 720px);
	--c: 64px;
	background:
		linear-gradient(var(--wp--preset--color--sky), var(--wp--preset--color--sky)) calc(var(--c) * 5 + 1px) calc(var(--c) * 2 + 1px) / calc(var(--c) - 1px) calc(var(--c) - 1px) no-repeat,
		linear-gradient(rgba(255,255,255,0.10), rgba(255,255,255,0.10)) calc(var(--c) * 3 + 1px) calc(var(--c) * 4 + 1px) / calc(var(--c) * 2 - 1px) calc(var(--c) - 1px) no-repeat,
		repeating-linear-gradient(to right, rgba(255,255,255,0.16) 0 1px, transparent 1px var(--c)),
		repeating-linear-gradient(to bottom, rgba(255,255,255,0.16) 0 1px, transparent 1px var(--c));
	-webkit-mask-image: linear-gradient(to right, transparent, #000 55%);
	mask-image: linear-gradient(to right, transparent, #000 55%);
	pointer-events: none;
}
@media (max-width: 781px) { .tws-hero::after { width: 100%; opacity: 0.35; } }
.tws-hero__title {
	font-size: clamp(2.5rem, 1.1rem + 5.4vw, 5.25rem);
	line-height: 0.98; letter-spacing: -0.025em; font-weight: 800;
	max-width: 12ch; text-wrap: balance; margin-block: 1.25rem 0;
}
.tws-hero__title span { color: var(--wp--preset--color--sky); }
.tws-hero__lede { font-size: var(--wp--preset--font-size--large); max-width: 34rem; }

/* ---------- Buttons ---------- */
.wp-block-button.is-style-outline > .wp-block-button__link { background: transparent; color: var(--wp--preset--color--primary); border: 2px solid var(--wp--preset--color--primary); padding: 0.85rem 1.4rem; }
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--wp--preset--color--primary); color: var(--wp--preset--color--white); }
.tws-dark .wp-block-button:not(.is-style-outline) > .wp-block-button__link { background: var(--wp--preset--color--sky); border-color: var(--wp--preset--color--sky); color: var(--wp--preset--color--navy); }
.tws-dark .wp-block-button:not(.is-style-outline) > .wp-block-button__link:hover { background: var(--wp--preset--color--white); border-color: var(--wp--preset--color--white); }
.tws-dark .wp-block-button.is-style-outline > .wp-block-button__link { color: var(--wp--preset--color--base); border-color: var(--wp--preset--color--base); }
.tws-dark .wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--wp--preset--color--base); color: var(--wp--preset--color--navy); }

/* ---------- Sections ---------- */
.tws-section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.tws-tint { background: var(--wp--preset--color--tint); }
.tws-statement { font-family: var(--wp--preset--font-family--display); font-weight: 600; font-size: clamp(1.5rem, 1rem + 1.9vw, 2.4rem); line-height: 1.22; letter-spacing: -0.012em; max-width: 52ch; text-wrap: pretty; }

/* ---------- Service cards ---------- */
.tws-services { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); margin-top: 2.5rem; }
@media (min-width: 900px) { .tws-services { grid-template-columns: repeat(2, 1fr); } }
.tws-card { background: var(--wp--preset--color--white); border: 1px solid var(--wp--preset--color--line); border-top: 4px solid var(--wp--preset--color--primary); padding: clamp(1.25rem, 3vw, 2rem); margin: 0 !important; }
.tws-card > * { margin-block: 0 0.75rem; }
.tws-card > :last-child { margin-bottom: 0; }
.tws-card .tws-label::before { display: none; }

/* ---------- Who we serve ---------- */
.tws-serve { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 0 2.5rem; }
.tws-serve li { padding: 0.9rem 0 0.9rem 1.6rem; border-bottom: 1px solid var(--wp--preset--color--line); position: relative; font-weight: 600; }
.tws-serve li::before { content: ""; position: absolute; left: 0; top: 1.4rem; width: 0.7rem; height: 0.7rem; background: var(--wp--preset--color--sky); outline: 1px solid var(--wp--preset--color--primary); }

/* ---------- Testimonial ---------- */
.tws-quote { border-left: 4px solid var(--wp--preset--color--sky); padding-left: clamp(1.25rem, 3vw, 2rem); margin-inline: 0; }
.tws-quote p { font-family: var(--wp--preset--font-family--display); font-weight: 500; font-size: var(--wp--preset--font-size--x-large); line-height: 1.3; font-style: normal; }
.tws-quote cite { font-style: normal; font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--muted); }

/* ---------- Entry lists ---------- */
.tws-entries .wp-block-post-template { list-style: none; margin: 0; padding: 0; }
.tws-entries .wp-block-post-template > li { border-top: 1px solid var(--wp--preset--color--line); margin: 0; padding-block: 1.75rem; }
.tws-entries .wp-block-post-template > li:last-child { border-bottom: 1px solid var(--wp--preset--color--line); }
.tws-entry { display: grid; gap: 0.35rem 2.5rem; }
@media (min-width: 782px) {
	.tws-entry { grid-template-columns: 10rem 1fr; }
	.tws-entry > .wp-block-post-date { grid-row: 1 / span 2; padding-top: 0.4rem; }
	.tws-entry > :not(.wp-block-post-date) { grid-column: 2; }
}
.tws-entry > * { margin: 0 !important; }
.tws-entry .wp-block-post-title a { text-decoration: none; }
.tws-entry .wp-block-post-title a:hover { text-decoration: underline; }
.tws-entry .wp-block-post-excerpt { color: var(--wp--preset--color--muted); max-width: 40rem; }
.tws-entry .wp-block-post-excerpt__excerpt { margin: 0; }

/* ---------- Article ---------- */
.tws-article-header { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 3vw, 2.5rem); }
.tws-article-header .wp-block-post-title, .tws-article-header h1 { text-wrap: balance; }
.entry-content :where(h2, h3, h4) { margin-top: 2em; }
.entry-content img { height: auto; }
.entry-content :where(th) { text-align: left; }
.entry-content :where(table) { font-size: var(--wp--preset--font-size--small); }

/* ---------- Forms ---------- */
:where(input[type="text"], input[type="email"], input[type="url"], input[type="tel"], input[type="search"], textarea, select) {
	border: 2px solid var(--wp--preset--color--muted); border-radius: 2px; background: #fff; color: var(--wp--preset--color--navy);
	font: inherit; padding: 0.7rem 0.85rem; min-height: 44px;
}
label, .wp-block-search__label { font-weight: 600; }

/* ---------- Footer ---------- */
.tws-footer { background-color: var(--wp--preset--color--deep) !important; border-top: 6px solid var(--wp--preset--color--sky); margin-top: clamp(3rem, 7vw, 5rem); }
.tws-footer .wp-block-site-title a { color: var(--wp--preset--color--white); text-decoration: none; }
.tws-footer .wp-block-navigation a { color: var(--wp--preset--color--base); text-decoration: underline; padding-block: 0.6rem; }
.tws-footer .tws-fine { font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--fine); }
.home .tws-footer, .tws-flush + footer .tws-footer { margin-top: 0; }

/* ---------- Preferences ---------- */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (forced-colors: active) {
	.tws-hero::after { display: none; }
	.tws-label::before, .tws-serve li::before { background: CanvasText; }
	.wp-block-button__link { border: 2px solid ButtonText; }
}
@media print { .tws-header nav, .tws-hero::after { display: none; } body { background: #fff; } }

/* Front page: bands sit flush against header and footer */
.home main.wp-block-group { margin-top: 0; }
.home footer.wp-block-template-part { margin-top: 0; }
.tws-footer .wp-block-navigation__container { gap: 0.15rem; }
@media (max-width: 781px) {
	.tws-hero::after {
		background:
			repeating-linear-gradient(to right, rgba(255,255,255,0.16) 0 1px, transparent 1px var(--c)),
			repeating-linear-gradient(to bottom, rgba(255,255,255,0.16) 0 1px, transparent 1px var(--c));
	}
}
.tws-serve { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }

/* Headings and text on navy bands */
.tws-dark :where(h1, h2, h3, h4, h5, h6) { color: var(--wp--preset--color--white); }
