/* =========================================================
   Site shell, header, navigation, and footer
   ========================================================= */

/* =========================================================
   Phase 2 Brand Layer
   ========================================================= */

.tr-site-header .wp-block-navigation a {
	position: relative;
	padding: 0.45rem 0.15rem;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.tr-site-header .wp-block-navigation a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -0.15rem;
	width: 0;
	height: 2px;
	border-radius: 2px;
	background: linear-gradient(90deg, var(--tr-primary) 0%, var(--tr-accent-light) 100%);
	transition: width 0.26s ease;
}

.tr-site-header .wp-block-navigation a:hover::after,
.tr-site-header .wp-block-navigation a:focus::after {
	width: 100%;
}


.tr-site-header {
	position: sticky;
	top: 0.65rem;
	z-index: 30;
	margin: 0.65rem clamp(0.75rem, 2.2vw, 2rem) 0;
	border-radius: var(--tr-radius-lg);
	border: 1px solid var(--tr-primary-tint-4);
	background: rgba(255, 255, 255, 0.88);
	backdrop-filter: blur(12px);
	box-shadow: var(--tr-shadow-lg);
}

.tr-site-header > .wp-block-group.alignwide {
	max-width: min(1640px, calc(100vw - 2rem));
	margin-left: auto;
	margin-right: auto;
}

.tr-site-header .wp-block-site-title {
	margin: 0;
	font-family: var(--tr-font-display);
	letter-spacing: -0.02em;
}

.tr-site-header .wp-block-navigation__container {
	gap: clamp(0.65rem, 1.2vw, 1.2rem);
}

.tr-site-header__actions {
	gap: 1.25rem;
	align-items: center;
}

.tr-site-header__buttons {
	gap: 0.6rem;
	align-items: center;
}

.tr-site-header__buttons .wp-block-button,
.tr-site-header__buttons .wp-block-shortcode {
	margin: 0;
}

.tr-site-header__buttons .wp-block-button__link {
	min-height: 42px;
	padding-inline: 0.9rem;
	border-radius: 999px;
}


/* The database-stored block template adds margin-top:spacing-60 to <main> as an
   inline style. The inner content group already has padding-top:spacing-60, so
   the margin doubles the gap. Inline styles can only be beaten with !important. */
main.wp-block-group {
	margin-top: 0 !important;
}

.tr-site-footer,
footer.wp-block-template-part {
	margin-top: -2px !important;
	margin-block-start: -2px !important;
	background: var(--tr-footer-bg);
	color: var(--tr-footer-text);
	overflow: hidden;
}

.tr-site-footer a,
footer.wp-block-template-part a {
	color: var(--tr-footer-text);
}

.tr-site-footer a:hover,
.tr-site-footer a:focus,
footer.wp-block-template-part a:hover,
footer.wp-block-template-part a:focus {
	color: #FFFFFF;
}

.tr-site-footer .wp-block-site-title a,
footer.wp-block-template-part .wp-block-site-title a {
	color: #FFFFFF !important;
	font-family: var(--tr-font-display);
	letter-spacing: -0.02em;
}

.tr-site-footer .wp-block-site-title a:hover,
footer.wp-block-template-part .wp-block-site-title a:hover {
	color: var(--tr-footer-accent) !important;
}

.tr-site-footer .tr-site-footer__links,
footer.wp-block-template-part .tr-site-footer__links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.6rem;
}

.tr-site-footer .tr-site-footer__links a,
footer.wp-block-template-part .tr-site-footer__links a {
	text-decoration: none;
	font-weight: 600;
}

.tr-site-footer .tr-site-footer__links a:hover,
.tr-site-footer .tr-site-footer__links a:focus,
footer.wp-block-template-part .tr-site-footer__links a:hover,
footer.wp-block-template-part .tr-site-footer__links a:focus {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

.tr-site-footer__meta,
footer.wp-block-template-part .tr-site-footer__meta {
	margin-top: clamp(1.2rem, 2.4vw, 2rem);
	padding-top: 1rem;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.5);
}


/* Header refresh: cleaner desktop hierarchy + mobile stacking */
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) {
	padding-block: clamp(0.7rem, 1.6vw, 1rem) !important;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) > .wp-block-group.alignwide {
	display: grid !important;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center !important;
	column-gap: clamp(0.85rem, 1.8vw, 1.8rem);
	row-gap: 0.7rem;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-site-title {
	font-size: clamp(1.05rem, 1.2vw, 1.25rem);
	line-height: 1.1;
	white-space: nowrap;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-site-title a {
	text-decoration: none;
}

.tr-site-header__actions {
	display: flex !important;
	justify-content: flex-end;
	align-items: center !important;
	gap: 0.75rem 1rem;
	min-width: 0;
}

.tr-site-header__actions .wp-block-navigation {
	margin: 0 !important;
}

.tr-site-header__actions .wp-block-navigation__container {
	flex-wrap: wrap !important;
	justify-content: flex-end !important;
}

.tr-site-header__buttons {
	display: flex !important;
	flex-wrap: wrap !important;
	justify-content: flex-end;
	gap: 0.55rem;
}

.tr-site-header__buttons > p {
	margin: 0;
}

.tr-site-header__buttons .wp-block-button,
.tr-site-header__buttons .wp-block-shortcode {
	margin: 0 !important;
}

.tr-site-header__buttons .wp-block-button__link,
.tr-site-header__buttons .tr-account-button {
	min-height: 40px;
	padding: 0.55rem 0.95rem !important;
	font-size: 0.9rem;
	white-space: nowrap;
}

@media (max-width: 940px) {
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) > .wp-block-group.alignwide {
		grid-template-columns: 1fr;
	}

	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-site-title {
		white-space: normal;
	}

	.tr-site-header__actions {
		justify-content: stretch;
	}

	.tr-site-header__actions .wp-block-navigation__container {
		justify-content: flex-start !important;
	}

	.tr-site-header__buttons {
		width: 100%;
		justify-content: flex-start;
	}
}

@media (max-width: 640px) {
	.tr-site-header__buttons {
		display: grid !important;
		grid-template-columns: 1fr;
	}

.tr-site-header__buttons .wp-block-button,
.tr-site-header__buttons .wp-block-shortcode,
.tr-site-header__buttons > p,
.tr-site-header__buttons .wp-block-button__link,
.tr-site-header__buttons .tr-account-button {
	width: 100% !important;
}

	/* Fallback for default block header markup (no custom .tr-site-header wrappers) */
	header.wp-block-template-part > .wp-block-group.alignfull > .wp-block-group.alignwide {
		display: grid !important;
		grid-template-columns: 1fr !important;
		gap: 0.55rem !important;
		align-items: stretch !important;
	}

	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-site-title {
		margin: 0 0 0.1rem !important;
		font-size: clamp(1.15rem, 5vw, 1.35rem) !important;
	}

	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-buttons,
	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-group.is-nowrap {
		display: grid !important;
		grid-template-columns: 1fr 1fr !important;
		gap: 0.55rem !important;
		width: 100% !important;
	}

	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-buttons {
		grid-template-columns: 1fr !important;
	}

	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-buttons .wp-block-button,
	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-group.is-nowrap > p {
		margin: 0 !important;
		width: 100% !important;
	}

	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-button__link,
	header.wp-block-template-part > .wp-block-group.alignfull .tr-account-button {
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
		min-height: 44px !important;
		padding: 0.58rem 0.85rem !important;
	}
}

/* Header mobile refinement: full-width primary + two compact secondary actions */
@media (max-width: 640px) {
	.tr-site-header .wp-block-site-title {
		margin-bottom: 0.25rem;
		font-size: clamp(1.15rem, 5vw, 1.35rem);
	}

	.tr-site-header .tr-site-header__actions {
		gap: 0.55rem;
	}

	.tr-site-header .tr-site-header__buttons {
		display: grid !important;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
		gap: 0.55rem !important;
		align-items: stretch !important;
		width: 100% !important;
	}

	.tr-site-header .tr-site-header__buttons > :first-child {
		grid-column: 1 / -1;
	}

	.tr-site-header .tr-site-header__buttons > :not(:first-child) {
		grid-column: auto;
	}

	.tr-site-header .tr-site-header__buttons .wp-block-button,
	.tr-site-header .tr-site-header__buttons .wp-block-shortcode,
	.tr-site-header .tr-site-header__buttons > p {
		width: auto !important;
		margin: 0 !important;
	}

	.tr-site-header .tr-site-header__buttons > :first-child,
	.tr-site-header .tr-site-header__buttons > :first-child .wp-block-button__link,
	.tr-site-header .tr-site-header__buttons > :first-child .tr-account-button {
		width: 100% !important;
	}

	.tr-site-header .tr-site-header__buttons .wp-block-button__link,
	.tr-site-header .tr-site-header__buttons .tr-account-button {
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
		min-height: 44px;
		padding: 0.58rem 0.85rem !important;
	}
}

@media (max-width: 768px) {
    header .wp-block-button__link,
    header .button,
    .site-header .wp-block-button__link,
    .site-header .button {
        padding: 8px 14px !important;
        font-size: 0.9rem !important;
        min-height: auto !important;
    }
}

/* Mobile overflow guard: keep header controls inside the viewport. */
.tr-site-header,
.tr-site-header *,
header.wp-block-template-part,
header.wp-block-template-part * {
	box-sizing: border-box;
}

@media (max-width: 640px) {
	.tr-site-header,
	header.wp-block-template-part > .wp-block-group.alignfull {
		width: calc(100% - 1rem) !important;
		max-width: calc(100% - 1rem) !important;
		margin: 0.5rem auto 0 !important;
		overflow-x: clip;
	}

	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) > .wp-block-group.alignwide,
	.tr-site-header__actions,
	.tr-site-header__buttons {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	.tr-site-header .tr-site-header__actions {
		display: grid !important;
		justify-content: stretch !important;
	}

	.tr-site-header .tr-site-header__buttons {
		display: grid !important;
		grid-template-columns: 1fr !important;
	}

	.tr-site-header .tr-site-header__buttons > *,
	.tr-site-header .tr-site-header__buttons .wp-block-button,
	.tr-site-header .tr-site-header__buttons .wp-block-shortcode,
	.tr-site-header .tr-site-header__buttons > p,
	.tr-site-header .tr-site-header__buttons .wp-block-button__link,
	.tr-site-header .tr-site-header__buttons .tr-account-button {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	.tr-site-header .tr-site-header__buttons .wp-block-button__link,
	.tr-site-header .tr-site-header__buttons .tr-account-button {
		white-space: normal;
		text-align: center;
	}
}

@media (max-width: 420px) {
	body.tr-registration-page header.wp-block-template-part .wp-block-buttons,
	body.tr-registration-page header.wp-block-template-part .wp-block-group.is-nowrap,
	body.tr-registration-page header.wp-block-template-part .wp-block-group-is-layout-flex {
		display: flex !important;
		flex-direction: column !important;
		align-items: stretch !important;
		justify-content: flex-start !important;
		gap: 0.55rem !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	body.tr-registration-page header.wp-block-template-part .wp-block-button,
	body.tr-registration-page header.wp-block-template-part .wp-block-button__link,
	body.tr-registration-page header.wp-block-template-part .tr-account-button,
	body.tr-registration-page header.wp-block-template-part .wp-block-group.is-nowrap > p {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
		margin: 0 !important;
	}

	header.wp-block-template-part > .wp-block-group.alignfull {
		width: calc(100vw - 2rem) !important;
		max-width: calc(100vw - 2rem) !important;
		overflow-x: clip !important;
	}

	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-buttons,
	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-group.is-nowrap,
	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-group-is-layout-flex {
		display: grid !important;
		grid-template-columns: 1fr !important;
		gap: 0.55rem !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-group.is-nowrap {
		flex-wrap: wrap !important;
	}

	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-group.is-nowrap > *,
	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-group-is-layout-flex > *,
	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-buttons > *,
	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-button,
	header.wp-block-template-part > .wp-block-group.alignfull p {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		margin: 0 !important;
	}

	header.wp-block-template-part > .wp-block-group.alignfull .wp-block-button__link,
	header.wp-block-template-part > .wp-block-group.alignfull .tr-account-button {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		white-space: normal !important;
	}
}

/* Header layout normalization: covers both the theme template and Site Editor saved markup. */
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) > .wp-block-group.alignwide {
	display: flex !important;
	align-items: center !important;
	justify-content: flex-start !important;
	flex-wrap: nowrap !important;
	gap: clamp(0.75rem, 1.4vw, 1.35rem) !important;
	width: 100% !important;
	max-width: min(1640px, calc(100vw - 2rem)) !important;
	min-width: 0 !important;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) > .wp-block-group.alignwide > :first-child {
	flex: 0 0 auto !important;
	width: auto !important;
	margin: 0 !important;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) > .wp-block-group.alignwide > :nth-child(2),
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .tr-site-header__actions {
	margin-left: auto !important;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) > .wp-block-group.alignwide > :nth-child(n+2),
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .tr-site-header__actions,
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .tr-site-header__buttons,
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-buttons,
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-group.is-nowrap {
	display: flex !important;
	align-items: center !important;
	justify-content: flex-end !important;
	flex-wrap: wrap !important;
	gap: 0.6rem !important;
	width: auto !important;
	max-width: none !important;
	min-width: 0 !important;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-site-logo,
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-site-logo a {
	display: inline-flex !important;
	align-items: center !important;
	margin: 0 !important;
	line-height: 0 !important;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-site-logo img {
	width: clamp(58px, 5.2vw, 74px) !important;
	height: auto !important;
	max-width: none !important;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-button,
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-shortcode,
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) p {
	width: auto !important;
	max-width: none !important;
	min-width: 0 !important;
	margin: 0 !important;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-shortcode:empty,
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) p:empty {
	display: none !important;
}

:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-button__link,
:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .tr-account-button {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: auto !important;
	max-width: 100% !important;
	min-width: 0 !important;
	min-height: 42px !important;
	padding: 0.58rem 1rem !important;
	box-sizing: border-box !important;
	white-space: nowrap !important;
	text-align: center !important;
}

@media (max-width: 782px) {
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) {
		width: calc(100% - 1rem) !important;
		max-width: calc(100% - 1rem) !important;
		margin: 0.5rem auto 0 !important;
		overflow-x: clip !important;
	}

	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) > .wp-block-group.alignwide {
		flex-direction: column !important;
		align-items: stretch !important;
		justify-content: flex-start !important;
		gap: 0.85rem !important;
		max-width: 100% !important;
	}

	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) > .wp-block-group.alignwide > :first-child,
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .tr-site-header__brand {
		display: flex !important;
		justify-content: center !important;
		width: 100% !important;
	}

	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-site-logo img {
		width: clamp(76px, 20vw, 96px) !important;
	}

	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) > .wp-block-group.alignwide > :nth-child(n+2),
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .tr-site-header__actions,
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .tr-site-header__buttons,
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-buttons,
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-group.is-nowrap {
		display: grid !important;
		grid-template-columns: 1fr !important;
		justify-content: stretch !important;
		align-items: stretch !important;
		gap: 0.55rem !important;
		width: 100% !important;
		max-width: 100% !important;
		margin-left: 0 !important;
	}

	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-button,
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-shortcode,
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) p,
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-button__link,
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .tr-account-button {
		width: 100% !important;
		max-width: 100% !important;
	}

	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .wp-block-button__link,
	:is(.tr-site-header, header.wp-block-template-part > .wp-block-group.alignfull) .tr-account-button {
		min-height: 44px !important;
		padding: 0.58rem 0.85rem !important;
		white-space: normal !important;
	}
}
