/*
 * TDI Starter: main stylesheet.
 *
 * REBRANDING: for each new client, edit only the BRAND TOKENS block below.
 * Everything else in this file reads from those tokens.
 */

/* ==========================================================================
   BRAND TOKENS (edit these per client)
   ========================================================================== */
:root {
	/* Colours */
	--color-primary: #1f4e79;   /* Buttons, links, main brand colour */
	--color-secondary: #2a7f62; /* Supporting brand colour */
	--color-accent: #e0a526;    /* Highlights, accent button */
	--color-dark: #14202b;      /* Body text, footer background */
	--color-gray: #5b6773;      /* Meta text, captions */
	--color-light: #f4f6f8;     /* Light section backgrounds */
	--color-white: #ffffff;     /* Page background, text on dark */

	/* Fonts. Self-host brand fonts with @font-face, then name them here. */
	--font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-heading: var(--font-body);

	/* Layout */
	--content-width: 720px;  /* Reading column */
	--wide-width: 1200px;    /* Site container and wide blocks */
	--radius: 0.5rem;        /* Buttons, cards, inputs */
}

/* Spacing (rarely needs changing) */
:root {
	--gutter: clamp(1rem, 4vw, 2rem);
	--section-space: clamp(3rem, 8vw, 5.5rem);
	--header-height: 4.5rem;
}

/* ==========================================================================
   Base
   ========================================================================== */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	font-family: var(--font-body);
	font-size: 1rem;
	line-height: 1.6;
	color: var(--color-dark);
	background: var(--color-white);
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0 0 0.5em;
	font-family: var(--font-heading);
	line-height: 1.2;
	text-wrap: balance;
}

h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem); }
h2 { font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.375rem); }
h3 { font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p { margin: 0 0 1em; }

a {
	color: var(--color-primary);
	text-underline-offset: 0.15em;
}

a:hover {
	text-decoration-thickness: 2px;
}

:focus-visible {
	outline: 3px solid var(--color-primary);
	outline-offset: 2px;
}

/* ==========================================================================
   Accessibility helpers
   ========================================================================== */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background: var(--color-white);
	box-shadow: 0 0 0 3px var(--color-primary);
	clip: auto;
	clip-path: none;
	color: var(--color-dark);
	display: block;
	height: auto;
	left: 0.5rem;
	padding: 0.75rem 1rem;
	top: 0.5rem;
	width: auto;
	z-index: 100000;
}

@media (prefers-reduced-motion: reduce) {
	* {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
	width: 100%;
	max-width: calc(var(--wide-width) + 2 * var(--gutter));
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.container--narrow {
	max-width: calc(var(--content-width) + 2 * var(--gutter));
}

.section {
	padding-block: var(--section-space);
}

/* Page and post content. Wide and full-width blocks break out of the reading
   column; everything else sits in it. */
.entry-content > *:not(.alignfull):not(.alignwide) {
	width: min(100% - 2 * var(--gutter), var(--content-width));
	margin-inline: auto;
}

.entry-content > .alignwide {
	width: min(100% - 2 * var(--gutter), var(--wide-width));
	max-width: none;
	margin-inline: auto;
}

.entry-content > .alignfull {
	width: 100%;
	max-width: none;
	margin-inline: 0;
}

.entry-content > * {
	margin-block: 1.25rem;
}

.entry-content > :first-child {
	margin-top: var(--section-space);
}

.entry-content > :last-child {
	margin-bottom: var(--section-space);
}

.entry-header {
	padding-top: var(--section-space);
	padding-bottom: 0.5rem;
}

.entry-thumbnail img {
	display: block;
	width: 100%;
	border-radius: var(--radius);
}

.entry-meta,
.card__meta {
	margin: 0;
	font-size: 0.875rem;
	color: var(--color-gray);
}

.entry-footer {
	padding-bottom: var(--section-space);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn,
.wp-element-button,
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.8em 1.5em;
	border: 2px solid var(--color-primary);
	border-radius: var(--radius);
	background: var(--color-primary);
	color: var(--color-white);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover,
.wp-element-button:hover,
.wp-block-button__link:hover {
	background: var(--color-dark);
	border-color: var(--color-dark);
	color: var(--color-white);
}

.btn--sm {
	padding: 0.55em 1.1em;
	font-size: 0.9375rem;
}

.btn--outline {
	background: transparent;
	color: var(--color-primary);
}

.btn--outline:hover {
	background: var(--color-primary);
	border-color: var(--color-primary);
	color: var(--color-white);
}

.btn--accent {
	background: var(--color-accent);
	border-color: var(--color-accent);
	color: var(--color-dark);
}

.btn--accent:hover {
	background: var(--color-dark);
	border-color: var(--color-dark);
	color: var(--color-white);
}

/* ==========================================================================
   Header and navigation
   ========================================================================== */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--color-white);
	border-bottom: 1px solid rgb(0 0 0 / 0.08);
}

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

@media (max-width: 782px) {
	.admin-bar .site-header { top: 46px; }
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: 1rem;
	min-height: var(--header-height);
}

.site-branding {
	margin-right: auto;
}

.site-title {
	font-family: var(--font-heading);
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--color-dark);
	text-decoration: none;
}

.custom-logo {
	display: block;
	width: auto;
	max-height: 3rem;
}

.site-nav .menu,
.site-footer .menu,
.site-footer__social {
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav a {
	display: block;
	padding: 0.5rem 0;
	color: var(--color-dark);
	font-weight: 600;
	text-decoration: none;
}

.site-nav a:hover,
.site-nav .current-menu-item > a,
.site-nav .current-menu-ancestor > a {
	color: var(--color-primary);
	text-decoration: underline;
	text-underline-offset: 0.3em;
}

/* Mobile menu */
.nav-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	border: 2px solid var(--color-dark);
	border-radius: var(--radius);
	background: transparent;
	cursor: pointer;
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	display: block;
	width: 1.25rem;
	height: 2px;
	background: var(--color-dark);
}

.nav-toggle__bars {
	position: relative;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
	content: "";
	position: absolute;
	left: 0;
}

.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }

@media (max-width: 899px) {
	.site-nav {
		display: none;
		position: absolute;
		top: 100%;
		right: 0;
		left: 0;
		padding: 0.5rem var(--gutter) 1.25rem;
		background: var(--color-white);
		border-bottom: 1px solid rgb(0 0 0 / 0.08);
	}

	.site-nav.is-open { display: block; }

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

@media (min-width: 900px) {
	.nav-toggle { display: none; }

	.site-nav .menu {
		display: flex;
		align-items: center;
		gap: 1.75rem;
	}

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

	.site-nav .sub-menu {
		position: absolute;
		top: 100%;
		left: -1rem;
		z-index: 10;
		display: none;
		min-width: 14rem;
		margin: 0;
		padding: 0.5rem 1rem;
		list-style: none;
		background: var(--color-white);
		border: 1px solid rgb(0 0 0 / 0.1);
		border-radius: var(--radius);
		box-shadow: 0 8px 24px rgb(0 0 0 / 0.08);
	}

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

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
	padding-top: clamp(2.5rem, 6vw, 4rem);
	background: var(--color-dark);
	color: rgb(255 255 255 / 0.85);
	font-size: 0.9375rem;
}

.site-footer a {
	color: var(--color-white);
}

.site-footer :focus-visible {
	outline-color: var(--color-white);
}

.site-footer__grid {
	display: grid;
	gap: 2rem;
}

@media (min-width: 768px) {
	.site-footer__grid { grid-template-columns: 2fr 1fr 1fr; }
}

.site-footer__name {
	margin-bottom: 0.75rem;
	font-family: var(--font-heading);
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--color-white);
}

.site-footer__address {
	margin-bottom: 1em;
	font-style: normal;
}

.site-footer li + li {
	margin-top: 0.4rem;
}

.site-footer__bottom {
	margin-top: 2rem;
	padding-block: 1.5rem;
	border-top: 1px solid rgb(255 255 255 / 0.15);
	font-size: 0.875rem;
}

.site-footer__bottom p { margin: 0; }

/* ==========================================================================
   Posts, cards, pagination
   ========================================================================== */
.archive-header {
	margin-bottom: 2rem;
}

.post-grid {
	display: grid;
	gap: 2rem;
	grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
}

.card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid rgb(0 0 0 / 0.1);
	border-radius: var(--radius);
	background: var(--color-white);
}

.card__media img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.card__body { padding: 1.25rem; }

.card__title {
	margin-bottom: 0.25rem;
	font-size: 1.25rem;
}

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

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

.pagination,
.post-navigation {
	margin-top: 2.5rem;
}

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

.post-navigation .nav-links { justify-content: space-between; gap: 1rem; }

.page-numbers {
	padding: 0.5rem 0.9rem;
	border: 1px solid rgb(0 0 0 / 0.15);
	border-radius: var(--radius);
	color: var(--color-dark);
	text-decoration: none;
}

.page-numbers.current {
	background: var(--color-primary);
	border-color: var(--color-primary);
	color: var(--color-white);
}

/* ==========================================================================
   Forms
   ========================================================================== */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="password"],
textarea,
select {
	width: 100%;
	padding: 0.7em 0.9em;
	border: 1px solid rgb(0 0 0 / 0.3);
	border-radius: var(--radius);
	background: var(--color-white);
	color: var(--color-dark);
	font: inherit;
}

.search-form {
	display: flex;
	gap: 0.5rem;
	max-width: 30rem;
	margin-block: 1rem;
}

.search-form label { flex: 1; }

.search-submit {
	padding: 0.7em 1.25em;
	border: 2px solid var(--color-primary);
	border-radius: var(--radius);
	background: var(--color-primary);
	color: var(--color-white);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
