/* Sticky lives on the template-part wrapper: the header alone is only as tall as its parent, so it would never stick. */
.wp-site-blocks > .wp-block-template-part:has(> .atv-header) {
	position: sticky;
	top: 0;
	z-index: 40;
}

/* The admin bar is fixed above 600px (and absolute below, where it scrolls away). */
@media (min-width: 601px) {
	.admin-bar .wp-site-blocks > .wp-block-template-part:has(> .atv-header) {
		top: var(--wp-admin--admin-bar--height, 0px);
	}
}

.atv-header {
	--atv-header-fg: var(--color-white);
	position: relative;
	min-height: var(--atv-header-h);
	color: var(--atv-header-fg);
	transition: background-color 200ms ease, box-shadow 200ms ease, color 200ms ease;
}

.atv-header--overlay {
	background: linear-gradient(180deg, rgb(11 18 21 / 0.45) 0%, rgb(11 18 21 / 0) 100%);
}

.atv-header--overlay.atv-header--scrolled,
.atv-header--solid {
	background: var(--color-white);
	color: var(--color-black-80);
	box-shadow: 0 1px 0 var(--color-black-10);
}

.atv-header__bar {
	display: flex;
	align-items: center;
	gap: var(--spacing-s);
	min-height: var(--atv-header-h);
	padding-block: var(--spacing-2-xs);
}

.atv-header__logo {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	margin-inline-end: auto;
}

.atv-logo {
	display: block;
	height: 2.75rem;
	width: auto;
}

.atv-header--overlay:not(.atv-header--scrolled) .atv-logo--dark,
.atv-header--solid .atv-logo--light,
.atv-header--scrolled .atv-logo--light {
	display: none;
}

.atv-header--overlay:not(.atv-header--scrolled) .atv-logo--light,
.atv-header--solid .atv-logo--dark,
.atv-header--scrolled .atv-logo--dark {
	display: block;
}

.atv-header__menu-toggle {
	appearance: none;
	background: transparent;
	border: 0;
	color: inherit;
	width: 44px;
	height: 44px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.atv-header__menu-toggle:focus-visible {
	outline: 3px solid var(--color-focus-outline);
	outline-offset: 2px;
}

.atv-header__menu-icon,
.atv-header__menu-icon::before,
.atv-header__menu-icon::after {
	display: block;
	width: 1.25rem;
	height: 2px;
	background: currentColor;
	position: relative;
}

.atv-header__menu-icon::before,
.atv-header__menu-icon::after {
	content: "";
	position: absolute;
	inset-inline-start: 0;
}

.atv-header__menu-icon::before {
	top: -6px;
}

.atv-header__menu-icon::after {
	top: 6px;
}

/* Open menu: the three bars become an X. */
.atv-header__menu-icon,
.atv-header__menu-icon::before,
.atv-header__menu-icon::after {
	transition: transform var(--atv-motion-fast) var(--atv-motion-ease), top var(--atv-motion-fast) var(--atv-motion-ease), background-color var(--atv-motion-fast) var(--atv-motion-ease);
}

.atv-header.is-open .atv-header__menu-icon {
	background-color: transparent;
}

.atv-header.is-open .atv-header__menu-icon::before {
	top: 0;
	transform: rotate(45deg);
}

.atv-header.is-open .atv-header__menu-icon::after {
	top: 0;
	transform: rotate(-45deg);
}

/* Dropdown chevron turns when its submenu is open. */
.atv-nav__button .hds-icon {
	flex: none;
	transition: transform var(--atv-motion-fast) var(--atv-motion-ease);
}

.atv-nav__item--open > .atv-nav__button .hds-icon {
	transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
	.atv-header__menu-icon,
	.atv-header__menu-icon::before,
	.atv-header__menu-icon::after,
	.atv-nav__button .hds-icon {
		transition: none;
	}
}

.atv-nav {
	font-family: var(--font-heading);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.atv-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0;
}

.atv-nav__item > a,
.atv-nav__button {
	display: inline-flex;
	align-items: center;
	gap: var(--spacing-3-xs);
	padding: var(--spacing-xs) var(--spacing-2-xs);
	color: inherit;
	white-space: nowrap;
	text-decoration: none;
	background: none;
	border: 0;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	cursor: pointer;
}

.wp-site-blocks .atv-header--overlay:not(.atv-header--scrolled):not(.is-open) .atv-nav__item > a,
.wp-site-blocks .atv-header--overlay:not(.atv-header--scrolled):not(.is-open) .atv-nav__button,
.wp-site-blocks .atv-header--overlay:not(.atv-header--scrolled):not(.is-open) .atv-header__search {
	color: var(--color-white);
}

.atv-nav__item > a:hover,
.atv-nav__button:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.atv-nav__item > a:focus-visible,
.atv-nav__button:focus-visible {
	outline: 3px solid var(--color-focus-outline);
	outline-offset: 2px;
}

.atv-nav__sub {
	display: none;
	list-style: none;
	margin: 0;
	padding: var(--spacing-xs);
	background: var(--color-white);
	color: var(--color-black-90);
	box-shadow: var(--box-shadow-m);
	min-width: 14rem;
	z-index: 5;
}

.atv-nav__item--open > .atv-nav__sub {
	display: block;
}

.atv-nav__sub a {
	display: block;
	padding: var(--spacing-2-xs) var(--spacing-xs);
	color: inherit;
	text-decoration: none;
	text-transform: none;
	letter-spacing: 0;
	font-weight: 600;
}

.atv-nav__sub a:hover {
	background: var(--color-bus-light);
}

.atv-nav__sub a:focus-visible {
	outline: 3px solid var(--color-focus-outline);
}

.atv-header__actions {
	display: flex;
	align-items: center;
	gap: var(--spacing-2-xs);
}

.atv-header__search {
	appearance: none;
	background: transparent;
	border: 0;
	color: inherit;
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

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

.atv-header__socio {
	display: none;
	flex: none;
	white-space: nowrap; /* never a two-line button */
}

.atv-header__socio .hds-button__label,
.atv-nav__socio .hds-button__label {
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 700;
	white-space: nowrap;
}

/* Sócio CTA at the bottom of the drawer (the bar's button is desktop only). */
.atv-nav__cta {
	display: none;
	margin: var(--spacing-s) 0 0;
	padding-top: var(--spacing-s);
	border-top: 1px solid var(--color-black-10);
	max-width: none;
}

.atv-nav__socio {
	width: 100%;
	justify-content: center;
	box-sizing: border-box;
}

/* ---- Rodapé ---------------------------------------------------------------
   Navy (.atv-on-dark) so it clearly ends the page under the tinted partner strip. Three tiers, three weights:
   brand + lima newsletter card · labelled link columns + contacts · a quiet bottom bar.
   Text on navy: white 10,98:1 · lima pálido (headings, labels) 8,5:1 · muted white ≥ 7:1 · lima 4,89:1.
   DOM order = visual order at every width. Tokens only. */
.atv-footer {
	--atv-footer-line: color-mix(in srgb, var(--color-white) 18%, var(--atv-navy));
	--atv-footer-muted: color-mix(in srgb, var(--color-white) 80%, var(--atv-navy));
	--atv-footer-soft: var(--atv-green-tint);
	margin-top: var(--spacing-layout-l);
}

/* Inner pages start the footer with the partner band: it brings its own top rule, no extra gap above it. */
.atv-footer:has(> .atv-footer__partners),
.wp-site-blocks > .wp-block-template-part:has(> .atv-footer > .atv-footer__partners) {
	margin-top: 0;
}

/* The search overlay part after the footer is empty in flow: no block gap (a white line under the navy). */
.wp-site-blocks > .wp-block-template-part:has(> .atv-footer) ~ .wp-block-template-part {
	margin-block-start: 0;
}

.atv-footer__body {
	padding-block-start: var(--spacing-layout-l);
}

.atv-footer__body :is(p, ul, dl, dd, h2) {
	margin: 0;
}

.atv-footer__body ul {
	list-style: none;
	padding: 0;
}

.atv-footer a {
	text-decoration: none;
	text-underline-offset: 0.2em;
	text-decoration-thickness: 1px;
	transition: color var(--atv-motion-fast) var(--atv-motion-ease), background-color var(--atv-motion-fast) var(--atv-motion-ease);
}

.atv-footer a:focus-visible {
	outline: var(--atv-focus-width) solid var(--color-focus-outline);
	outline-offset: var(--atv-focus-offset);
}

/* Tier 1: brand + newsletter. */
.atv-footer__top {
	display: grid;
	gap: var(--spacing-layout-m);
	padding-block-end: var(--spacing-layout-m);
	border-block-end: 1px solid var(--atv-footer-line);
}

.atv-footer__brand {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--spacing-s);
}

.atv-footer__logo {
	display: inline-flex;
	border-radius: var(--atv-radius-s);
}

.atv-footer__logo .atv-logo {
	height: 4rem;
}

.atv-footer__marker {
	--atv-marker-height: 0.625rem;
	--atv-marker-gap: 0;
	display: block;
	margin-block-start: var(--spacing-2-xs);
}

.atv-footer__blurb {
	max-width: 30rem;
	font-size: var(--fontsize-body-m);
	line-height: var(--lineheight-l);
	color: var(--atv-footer-muted);
}

.atv-footer__social {
	display: flex;
	flex-wrap: wrap;
	gap: var(--spacing-2-xs);
	margin-block-start: var(--spacing-2-xs);
}

.atv-footer .atv-footer__social-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	box-sizing: border-box;
	border: 1px solid var(--atv-footer-muted);
	border-radius: 50%;
	color: var(--color-white);
	font-family: var(--font-heading);
	font-size: 0.75rem;
	font-weight: 800;
	letter-spacing: 0.04em;
}

.atv-footer__social-icon {
	display: block;
	width: 20px;
	height: 20px;
}

.atv-footer .atv-footer__social-link:hover {
	background-color: var(--atv-green);
	border-color: var(--atv-green);
	color: var(--atv-navy);
}

/* Newsletter: the footer's one call to action, a lima card (navy on lima 4,89:1; the ring turns navy here). */
.atv-footer__newsletter {
	--color-focus-outline: var(--atv-focus-light);
	display: grid;
	gap: var(--spacing-xs);
	align-self: start;
	padding: var(--spacing-l);
	border-radius: var(--atv-radius-m);
	background-color: var(--atv-green);
	color: var(--atv-navy);
}

.atv-footer .atv-footer__newsletter-title {
	font-family: var(--font-heading);
	font-size: var(--fontsize-heading-m);
	font-weight: 800;
	line-height: 1.2;
	color: var(--atv-navy);
}

.atv-footer__newsletter-pitch {
	font-size: var(--fontsize-body-l);
}

.atv-footer-newsletter {
	display: grid;
	gap: var(--spacing-3-xs);
	margin-block-start: var(--spacing-xs);
}

.atv-footer-newsletter__label {
	font-size: var(--fontsize-body-s);
	font-weight: 700;
}

.atv-footer-newsletter__row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--spacing-2-xs);
	align-items: stretch;
}

.atv-footer-newsletter .hds-text-input__input-wrapper {
	flex: 1 1 13rem;
}

.atv-footer-newsletter .hds-text-input__input {
	border-color: var(--atv-navy);
}

.atv-footer-newsletter__submit.hds-button {
	--background-color: var(--atv-navy);
	--background-color-hover: var(--atv-scrim);
	--background-color-focus: var(--atv-navy);
	--background-color-active: var(--atv-scrim);
	--border-color: var(--atv-navy);
	--border-color-hover: var(--atv-scrim);
	--border-color-focus: var(--atv-navy);
	--border-color-active: var(--atv-scrim);
	--color: var(--color-white);
	--color-hover: var(--color-white);
	--color-focus: var(--color-white);
	--color-active: var(--color-white);
	--outline-color-focus: var(--atv-focus-light);
	flex: 0 0 auto;
}

/* Tier 2: link columns + contacts. */
.atv-footer__main {
	display: grid;
	gap: var(--spacing-layout-m);
	padding-block: var(--spacing-layout-m) var(--spacing-layout-l);
}

.atv-footer__nav {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--spacing-l);
}

.atv-footer .atv-footer__heading {
	margin-block-end: var(--spacing-s);
	font-family: var(--font-heading);
	font-size: var(--fontsize-body-s);
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--atv-footer-soft);
}

.atv-footer__links a,
.atv-footer__contact a,
.atv-footer__legal a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	box-sizing: border-box;
}

.atv-footer .atv-footer__links a {
	font-size: var(--fontsize-body-m);
	font-weight: 500;
	color: var(--color-white);
}

.atv-footer .atv-footer__links a:hover,
.atv-footer .atv-footer__contact a:hover {
	color: var(--atv-footer-soft);
	text-decoration-line: underline;
}

/* Two label/value columns when the column is wide enough (tablet, wide desktop); one otherwise. */
.atv-footer__contact-list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
	gap: var(--spacing-m) var(--spacing-l);
}

/* Each column stacks its own items: Morada + Email | Telefone + Horário, no shared row heights. */
.atv-footer__contact-col {
	display: grid;
	align-content: start;
	gap: var(--spacing-m);
}

.atv-footer__contact-item dt {
	margin-block-end: var(--spacing-3-xs);
	font-family: var(--font-heading);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--atv-footer-muted);
}

.atv-footer__contact-item dd {
	text-wrap: pretty;
	font-size: var(--fontsize-body-l);
	line-height: var(--lineheight-m);
	color: var(--color-white);
}

.atv-footer .atv-footer__contact a {
	color: var(--color-white);
	text-decoration-line: underline;
	text-decoration-color: var(--atv-footer-line);
	overflow-wrap: anywhere;
}

.atv-footer .atv-footer__map {
	display: inline-block;
	min-height: 44px;
	padding-block: var(--spacing-3-xs);
}

.atv-footer__contact .atv-phone {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	column-gap: var(--spacing-2-xs);
}

.atv-footer__contact .atv-phone__label {
	font-size: var(--fontsize-body-s);
	color: var(--atv-footer-muted);
}

/* Tier 3: bottom bar, smaller and quieter. */
.atv-footer__meta {
	border-block-start: 1px solid var(--atv-footer-line);
	padding-block: var(--spacing-xs);
	font-size: var(--fontsize-body-s);
	color: var(--atv-footer-muted);
}

.atv-footer__meta-inner {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--spacing-l);
	justify-content: space-between;
	align-items: center;
}

.atv-footer__copy {
	padding-block: var(--spacing-2-xs);
}

.atv-footer__legal {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--spacing-m);
}

.atv-footer .atv-footer__legal a {
	color: var(--atv-footer-muted);
}

.atv-footer .atv-footer__legal a:hover {
	color: var(--color-white);
	text-decoration-line: underline;
}


@media (min-width: 992px) {
	.atv-footer__top,
	.atv-footer__main {
		grid-template-columns: repeat(12, minmax(0, 1fr));
		column-gap: var(--spacing-l);
	}

	.atv-footer__brand,
	.atv-footer__nav {
		grid-column: 1 / span 5;
	}

	.atv-footer__newsletter,
	.atv-footer__contact {
		grid-column: 7 / span 6;
	}

	.atv-footer__top--solo .atv-footer__brand {
		grid-column: 1 / -1;
	}

	.atv-footer__newsletter {
		padding: var(--spacing-xl);
	}

	/* Desktop rows can be tighter (WCAG 2.5.8 needs 24px; these stay at 32–36px). */
	.atv-footer__links a {
		min-height: 2.25rem;
	}

	.atv-footer__contact .atv-phone a {
		min-height: 2rem;
	}

	.atv-footer .atv-footer__map {
		min-height: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.atv-footer a {
		transition: none;
	}
}

@media (forced-colors: active) {
	.atv-footer__newsletter {
		border: 1px solid CanvasText;
	}
}

/* Desktop nav from 1248px (HDS breakpoint-xl, where the container is 1200px): six uppercase items, the search button and
   "Faz-te sócio" only fit on one row there. Below it the burger takes over, so the bar never wraps to a second row. */
@media (max-width: 1247px) and (min-width: 601px) {
	.atv-header .atv-nav {
		max-height: calc(100svh - var(--atv-header-h) - var(--wp-admin--admin-bar--height, 0px));
	}
}

@media (max-width: 1247px) {
	.atv-nav__cta {
		display: block;
	}

	.atv-nav {
		display: none;
		position: absolute;
		inset-inline: 0;
		top: var(--atv-header-h);
		background: var(--color-white);
		color: var(--color-black-90);
		padding: var(--spacing-s);
		box-shadow: var(--box-shadow-m);
		max-height: calc(100svh - var(--atv-header-h));
		overflow: auto;
	}

	.atv-header.is-open .atv-nav {
		display: block;
	}

	.atv-nav__list {
		flex-direction: column;
		align-items: stretch;
	}

	/* Full-width rows in the drawer; the dropdown button spreads label and chevron. */
	.atv-nav__item > a,
	.atv-nav__button {
		display: flex;
		width: 100%;
		justify-content: space-between;
		min-height: 44px;
		box-sizing: border-box;
	}

	/* Submenu: an indented accordion inside the drawer, not a floating card. */
	.atv-nav__sub {
		min-width: 0;
		padding: 0 0 var(--spacing-2-xs);
		background: transparent;
		box-shadow: none;
		border-inline-start: 2px solid var(--color-black-10);
		margin-inline-start: var(--spacing-2-xs);
	}

	.atv-nav__sub a {
		min-height: 44px;
		display: flex;
		align-items: center;
		box-sizing: border-box;
	}

	/* Open drawer: the page behind it does not scroll (header.js sets the class). */
	html.atv-menu-open,
	html.atv-menu-open body {
		overflow: hidden;
	}

	.atv-header--overlay:not(.atv-header--scrolled).is-open {
		background: var(--color-white);
		color: var(--color-black-90);
	}

	.atv-header--overlay:not(.atv-header--scrolled).is-open .atv-logo--light {
		display: none;
	}

	.atv-header--overlay:not(.atv-header--scrolled).is-open .atv-logo--dark {
		display: block;
	}
}

@media (min-width: 1248px) {
	.atv-header__menu-toggle {
		display: none;
	}

	.atv-nav {
		display: block;
	}

	.atv-nav__item--has-children {
		position: relative;
	}

	.atv-nav__sub {
		position: absolute;
		top: 100%;
		inset-inline-start: 0;
	}

	.atv-header__socio {
		display: inline-flex;
	}

	/* One row, always: items never wrap (the breakpoint above leaves room, a tighter inline padding keeps room for Agenda). */
	.atv-nav__list {
		flex-wrap: nowrap;
	}

	.atv-nav__item > a,
	.atv-nav__button {
		padding-inline: var(--spacing-3-xs);
	}
}
