/**
 * Casas Choice — site-wide header / nav.
 *
 * 1. "Contactos" header button        (.nav-btn)
 * 2. Language switcher trigger + modal (.cc-lang-*, .cc-modal)
 * 3. Mobile off-canvas menu            (.mobile-menu, .cc-mobile-*, .cc-submenu-*)
 *
 * Uses the theme's own --theme-palette-color-* tokens (style.css) — matches
 * the Penpot "Compras" nav board 1:1. Some rules need !important because
 * Blocksy's own generated header/menu CSS targets the same elements with
 * comparable specificity (confirmed necessary for the header override in
 * assets/css/imovel.css already).
 */

:root {
	/* Fallback only (matches the mobile header's own height) — nav.js
	   measures the real, currently-rendered header (`#header`) on load
	   and on resize and keeps this in sync, so the off-canvas panel sits
	   right below it whether that's 62px on mobile, taller on tablet, or
	   pushed down further by the WP admin bar when logged in. */
	--cc-header-height: 62px;
}

/* -------------------------------------------------------------------- *
 * 0. Off-canvas panel — starts below the header instead of covering it
 * -------------------------------------------------------------------- */

#offcanvas {
	top: var(--cc-header-height) !important;
	height: calc(100vh - var(--cc-header-height)) !important;
}

#offcanvas .ct-panel-actions {
	display: none;
}

/* While the mobile menu is open the header bar goes solid #F2F3F4, same as
 * the desktop supermenu does (assets/css/supermenu.css) — on a transparent
 * header (hero pages) the bar is see-through, so the open panel would sit
 * under a floating white logo/burger. Blocksy flags the open panel with
 * `.active` on #offcanvas, and flips body's data-panel to "out" the instant
 * it starts closing (`.active` itself lingers until the fade ends) — keying
 * on `data-panel*="in"` makes the bar fade back in step with the panel.
 * :has() lets the header react without any JS.
 * Links/logo/icons get the same dark treatment as Blocksy's own scrolled
 * (sticky) state, via the same logo swap and ink colour — everything
 * animates at the off-canvas panel's own 0.25s ease-in-out. */
body[data-panel*="in"]:has( #offcanvas.active ) #header [data-device="mobile"] [data-row*="middle"] {
	background-color: #F2F3F4;
}

/* Logo: the two variants cross-fade (same 0.25s ease-in-out Blocksy uses
 * for the off-canvas panel itself) instead of snapping via display:none —
 * they're stacked, the dark one in flow, the other absolutely overlaid. */
#header [data-device="mobile"] .site-logo-container {
	position: relative;
	display: inline-block;
}

#header [data-device="mobile"] .site-logo-container img {
	display: block !important;
	transition: opacity 0.25s ease-in-out;
}

#header [data-device="mobile"] .site-logo-container .sticky-logo {
	position: absolute;
	top: 0;
	left: 0;
	opacity: 0;
}

#header [data-device="mobile"] .site-logo-container .default-logo {
	opacity: 1;
}

/* Blocksy's scrolled (sticky) state and the open menu both show the
 * "sticky" variant. */
#header [data-device="mobile"] [data-sticky*="yes"] .site-logo-container .sticky-logo,
body[data-panel*="in"]:has( #offcanvas.active ) #header [data-device="mobile"] .site-logo-container .sticky-logo {
	opacity: 1;
}

#header [data-device="mobile"] [data-sticky*="yes"] .site-logo-container .default-logo,
body[data-panel*="in"]:has( #offcanvas.active ) #header [data-device="mobile"] .site-logo-container .default-logo {
	opacity: 0;
}

/* Same duration/easing as the panel for the bar's background and the
 * burger/globe icon colours, so everything moves in lockstep. */
#header [data-device="mobile"] [data-row*="middle"] {
	transition: background-color 0.25s ease-in-out;
}

#header [data-device="mobile"] [data-id="trigger"] .ct-trigger,
#header [data-device="mobile"] [data-id="trigger"] .ct-icon {
	transition: color 0.25s ease-in-out, fill 0.25s ease-in-out;
}

#header [data-device="mobile"] .cc-lang-trigger__btn svg path {
	transition: fill 0.25s ease-in-out;
}

body[data-panel*="in"]:has( #offcanvas.active ) #header [data-device="mobile"] [data-id="trigger"] .ct-trigger,
body[data-panel*="in"]:has( #offcanvas.active ) #header [data-device="mobile"] [data-id="trigger"] .ct-icon {
	--theme-icon-color: var( --theme-palette-color-5, #333538 );
	color: var( --theme-palette-color-5, #333538 );
	fill: var( --theme-palette-color-5, #333538 );
}

body[data-panel*="in"]:has( #offcanvas.active ) #header [data-transparent-row="yes"] .cc-lang-trigger__btn svg path {
	fill: var( --theme-palette-color-5, #333538 );
}

#offcanvas .mobile-menu>ul {
	border-top: 0;
}

/* -------------------------------------------------------------------- *
 * 1. "Contactos" header button
 * -------------------------------------------------------------------- */

#header [data-items] ul {
	display: flex;
	align-items: center;
	gap: 32px;
}

.menu>li>.ct-menu-link {
	padding: 0;
}

.ct-header .menu-item.nav-btn {
	margin-left: 4px;
}

.ct-header .menu-item.nav-btn {
	height: 36px !important;
}

.ct-header .menu-item.nav-btn > a.ct-menu-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 26px !important;
	background-color: var(--theme-palette-color-5) !important;
	color: var(--theme-palette-color-9) !important;
	border: 1px solid rgba(196, 199, 202, 0.6);
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.3;
	white-space: nowrap;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ct-header .menu-item.nav-btn > a.ct-menu-link:focus-visible {
	background-color: var(--theme-palette-color-6) !important;
	border-color: var(--theme-palette-color-7);
}

@media (hover: hover) {
	.ct-header .menu-item.nav-btn > a.ct-menu-link:hover {
		background-color: var(--theme-palette-color-6) !important;
		border-color: var(--theme-palette-color-7);
	}
}

/* -------------------------------------------------------------------- *
 * 2. Language switcher — desktop trigger
 * -------------------------------------------------------------------- */

.cc-lang-item--hidden {
	display: none !important;
}

.ct-header li.cc-lang-trigger {
	display: flex;
	align-items: center;
}

.cc-lang-trigger__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	background: transparent;
	border: 1px solid var(--theme-palette-color-7);
	border-radius: 999px;
	color: var(--theme-palette-color-5);
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.cc-lang-trigger__btn:focus-visible {
	background-color: var(--theme-palette-color-8);
	border-color: var(--theme-palette-color-5);
}

@media (hover: hover) {
	.cc-lang-trigger__btn:hover {
		background-color: var(--theme-palette-color-8);
		border-color: var(--theme-palette-color-5);
	}
}

.cc-lang-trigger__btn svg {
	width: 16px;
	height: 16px;
}

/* Same trigger, restyled small when it ends up inside the mobile off-canvas
   top bar (kept out of scope for content today, styled defensively in case
   the "Off-canvas logo" header row is enabled later). */
#offcanvas .cc-lang-trigger__btn {
	border-color: rgba(51, 53, 56, 0.3);
}

/* Collapsed mobile header bar — sits directly left of the hamburger trigger. */
[data-device="mobile"] .cc-lang-trigger__btn--mobile-bar {
	flex-shrink: 0;
	margin-right: 12px;
}

/* -------------------------------------------------------------------- *
 * 3. Generic modal (shared by the language switcher; reusable for any
 *    future header modal)
 * -------------------------------------------------------------------- */

.cc-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.cc-modal[hidden] {
	display: none;
}

.cc-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(24, 21, 16, 0.55);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.cc-modal__panel {
	position: relative;
	width: 100%;
	max-width: 360px;
	background: var(--theme-palette-color-9);
	border-radius: 12px;
	box-shadow: 0 24px 48px rgba(24, 21, 16, 0.24);
	padding: 24px;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.cc-modal.is-open .cc-modal__overlay {
	opacity: 1;
}

.cc-modal.is-open .cc-modal__panel {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.cc-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}

.cc-modal__title {
	font-family: 'Montserrat', sans-serif;
	font-size: 20px;
	font-weight: 500;
	color: var(--theme-palette-color-5);
	margin: 0;
}

.cc-modal__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: transparent;
	border: none;
	color: var(--theme-palette-color-5);
	cursor: pointer;
	border-radius: 6px;
	transition: background-color 0.2s ease;
}

.cc-modal__close:focus-visible {
	background-color: var(--theme-palette-color-8);
}

@media (hover: hover) {
	.cc-modal__close:hover {
		background-color: var(--theme-palette-color-8);
	}
}

body.cc-modal-open {
	overflow: hidden;
}

/* Language list, specifically — rows ruled like the site's accordions,
   inside the "Acesso antecipado" dialog dress (style.css). */

.cc-modal.cc-lang-modal .cc-modal__panel {
	max-width: 560px;
}

.cc-lang-modal__list {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--theme-palette-color-7);
}

.cc-lang-modal__list li {
	margin: 0;
	border-bottom: 1px solid var(--theme-palette-color-7);
}

.cc-lang-modal__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 0;
	font-size: 20px;
	font-weight: 300;
	line-height: 1.3;
	color: var(--cc-ink, var(--theme-palette-color-5));
	text-decoration: none;
	transition: color 0.2s ease;
}

.cc-lang-modal__item:focus-visible {
	outline: none;
	color: var(--cc-accent, var(--theme-palette-color-1));
}

@media (hover: hover) {
	.cc-lang-modal__item:hover {
		color: var(--cc-accent, var(--theme-palette-color-1));
	}
}

.cc-lang-modal__item.is-current {
	color: var(--cc-accent, var(--theme-palette-color-1));
}

.cc-lang-modal__item.is-current svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

@media (max-width: 689px) {
	.cc-lang-modal__item {
		padding: 16px 0;
		font-size: 18px;
	}
}

/* -------------------------------------------------------------------- *
 * 4. Mobile off-canvas menu — base nav-row restyle
 * -------------------------------------------------------------------- */

#offcanvas .mobile-menu {
	padding: 0;
	overflow: hidden;
	/* Blocksy's panel lays this out as a flex item; `overflow: hidden` (needed
	   to clip the drill-down slide) otherwise disables the browser's default
	   "don't shrink below content size" behaviour for flex items, and the
	   panel was squeezing the menu shorter than its own rows (clipping the
	   last one) to make room for whatever comes after it. */
	flex-shrink: 0;
}

#offcanvas .mobile-menu > ul {
	position: relative;
}

#offcanvas .mobile-menu .menu-item {
	border-bottom: 1px solid rgba(196, 199, 202, 0.5);
}

#offcanvas .mobile-menu > ul > li > a.ct-menu-link,
#offcanvas .mobile-menu .ct-sub-menu-parent > a.ct-menu-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 0 !important;
	min-height: 57px;
	font-family: 'Montserrat', sans-serif;
	font-size: 30px !important;
	font-weight: 400 !important;
	color: var(--theme-palette-color-5) !important;
	line-height: 1.4;
}

#offcanvas .mobile-menu .ct-toggle-dropdown-mobile {
	display: flex;
	align-items: center;
	justify-content: center;
	position: static;
	width: 24px;
	height: 24px;
	color: var(--theme-palette-color-5);
}

#offcanvas .mobile-menu .ct-toggle-dropdown-mobile svg {
	width: 24px;
	height: 24px;
}

/* Off-Market row: text stays left, lock icon sits right after it (not
   pushed to the far right like the chevron rows). */
#offcanvas .mobile-menu > ul > li > a.ct-menu-link {
	justify-content: flex-start;
}

/* Every menu's Off-Market lock (desktop bar + mobile menu): it's a stroke-
   only outline, but Blocksy's core CSS forces `fill` onto any menu-link svg
   while its <li> is hovered (`nav[class*=menu] li:hover > .ct-menu-link svg`),
   which turned the inside solid blue. Pin fill to none so hover only
   recolours the line (via currentColor). */
.menu-item .ct-menu-link .ccf-om-lock {
	fill: none !important;
}

@media (hover: hover) {
	.menu-item:hover > .ct-menu-link .ccf-om-lock {
		fill: none !important;
	}
}

/* The plugin's own lock (.ccf-om-lock, appended to the Off-Market item) is
   the one that stays in the mobile menu — sized to match .cc-lock-icon. */
#offcanvas .mobile-menu .ccf-om-lock {
	width: 24px;
	height: 24px;
	flex: none;
	margin-left: 8px;
	color: var(--theme-palette-color-5);
	/* Same Blocksy hover `fill` rule as .cc-lock-icon below — keep it a
	   stroke-only outline. */
	fill: none !important;
}

@media (hover: hover) {
	#offcanvas .mobile-menu > ul > li:hover > a.ct-menu-link .ccf-om-lock {
		color: var(--theme-icon-hover-color, var(--theme-link-hover-color));
	}
}

.cc-lock-icon {
	display: inline-flex;
	width: 16px;
	height: 16px;
	color: var(--theme-palette-color-5);
}

.cc-lock-icon svg {
	width: 100%;
	height: 100%;
	/* Blocksy's own core CSS forces `fill` on any menu-link svg while its
	   <li> is hovered (main.min.css: `nav[class*=menu] li:hover >
	   .ct-menu-link svg { fill: ... }` — .mobile-menu matches
	   nav[class*=menu]). This icon is stroke-only (fill: none in its
	   markup); without this override that rule fills it into a solid
	   blob on hover instead of just recoloring the outline. */
	fill: none !important;
}

@media (hover: hover) {
	#offcanvas .mobile-menu > ul > li:hover > a.ct-menu-link .cc-lock-icon {
		color: var(--theme-icon-hover-color, var(--theme-link-hover-color));
	}
}

/* -------------------------------------------------------------------- *
 * 5. Submenu drill-down
 *
 * The main <ul> and each submenu are independent sliding layers stacked
 * in the same box (nav.js reparents every .sub-menu out of its <li> and
 * into .cc-submenu-screens for exactly this reason — nesting a submenu
 * inside a <li> that itself gets transformed would compound the two
 * transforms instead of keeping them independent).
 * -------------------------------------------------------------------- */

#offcanvas .mobile-menu {
	position: relative;
}

#offcanvas .mobile-menu > ul {
	transition: transform 0.25s ease;
}

#offcanvas .mobile-menu.cc-submenu-open > ul {
	transform: translateX(-100%);
}

.ct-toggle-dropdown-desktop {
	--toggle-button-margin-start: 0 !important;
}

@media (hover: hover) {
	.ct-menu-link:hover .ct-icon {
		transform: rotate(180deg);
	}
}

.cc-submenu-screens {
	/* .mobile-menu carries no horizontal padding of its own any more (the
	   gutter now lives once, on .ct-panel-content-inner) — so this just
	   fills .mobile-menu's own box, same as the main <ul> does. */
	position: absolute;
	inset: 0;
	pointer-events: none;
}

#offcanvas .mobile-menu .cc-submenu-screen {
	list-style: none;
	margin: 0;
	padding: 0;
	position: absolute;
	inset: 0;
	background-color: var(--theme-palette-color-8);
	transform: translateX(100%);
	visibility: hidden;
	transition: transform 0.25s ease, visibility 0s linear 0.25s;
	pointer-events: none;
}

/* Whichever screen JS marks .is-active slides in; class lives on the
   screen itself so this scales to any number of submenus with one rule. */
#offcanvas .mobile-menu .cc-submenu-screen.is-active {
	transform: translateX(0);
	visibility: visible;
	transition: transform 0.25s ease;
	pointer-events: auto;
}

.cc-submenu-back {
	border-bottom: 1px solid rgba(196, 199, 202, 0.5);
}

.cc-submenu-back__btn {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 8px 0;
	min-height: 57px;
	background: transparent;
	border: none;
	cursor: pointer;
	font-family: 'Montserrat', sans-serif;
	font-size: 18px;
	font-weight: 400;
	color: var(--theme-palette-color-5);
	text-align: left;
}

.cc-submenu-back__btn svg {
	flex-shrink: 0;
}

#header .menu li.menu-item, #header .menu li.page_item {
	height: 100%;
}

@media (prefers-reduced-motion: reduce) {
	#offcanvas .mobile-menu > ul,
	#offcanvas .mobile-menu .cc-submenu-screen {
		transition: none !important;
	}
}

/* -------------------------------------------------------------------- *
 * 6. Mobile off-canvas — "Contactos" block + CTA buttons
 * -------------------------------------------------------------------- */

.cc-mobile-contacts {
	padding: 32px 0 0;
}

.cc-mobile-contacts__heading {
	margin: 0 0 24px;
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--theme-palette-color-5);
}

.cc-mobile-contacts__address {
	display: flex;
	flex-direction: column;
	margin: 0 0 16px;
	font-size: 14px;
	font-weight: 400;
	color: var(--theme-palette-color-5);
}

.cc-mobile-contacts__line {
	display: block;
	margin-bottom: 8px;
	font-size: 14px;
	font-weight: 400;
	color: var(--theme-palette-color-5);
	text-decoration: none;
}

@media (hover: hover) {
	.cc-mobile-contacts__line:hover {
		text-decoration: underline;
	}
}

.cc-mobile-contacts__socials:empty {
	display: none;
}

.cc-mobile-contacts__socials {
	margin-top: 20px;
}

.cc-mobile-contacts__socials .ct-header-socials {
	padding: 0;
}

.cc-mobile-contacts__socials .ct-social-box {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.cc-mobile-contacts__socials .ct-social-box a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: 1px solid rgba(51, 53, 56, 0.22);
	border-radius: 50%;
	transition: border-color 0.2s ease;
}

/* Blocksy paints a hovered social icon in the palette's green
 * (`--theme-icon-hover-color`, falling back to palette-2). On a phone the
 * tapped icon kept matching :hover, so it stayed green after the tap. The
 * icon keeps its normal colour; with a mouse, hover darkens the circle. */
.cc-mobile-contacts__socials .ct-social-box {
	--theme-icon-hover-color: var(--theme-palette-color-5);
}

@media (hover: hover) {
	.cc-mobile-contacts__socials .ct-social-box a:hover {
		border-color: var(--theme-palette-color-5);
	}
}

.cc-mobile-cta {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 0 0 32px;
}

#offcanvas .ct-panel-content-inner>* {
	width: 100%;
}

[data-header*="type-1"] #offcanvas .ct-panel-inner {
	box-shadow: none;
}

.cc-mobile-cta__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 24px;
	background-color: var(--theme-palette-color-5);
	border: 1px solid rgba(196, 199, 202, 0.6);
	border-radius: 6px;
	color: var(--theme-palette-color-9) !important;
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.cc-mobile-cta__btn:focus-visible {
	background-color: var(--theme-palette-color-6);
}

@media (hover: hover) {
	.cc-mobile-cta__btn:hover {
		background-color: var(--theme-palette-color-6);
	}
}

.cc-mobile-cta__icon {
	flex-shrink: 0;
}

/* Secondary action: outline only, so it doesn't compete with the primary
 * filled button above it. */
.cc-mobile-cta__btn--secondary {
	background-color: transparent;
	border-color: var(--theme-palette-color-5);
	color: var(--theme-palette-color-5) !important;
}

.cc-mobile-cta__btn--secondary:focus-visible {
	background-color: var(--theme-palette-color-5);
	color: var(--theme-palette-color-9) !important;
}

@media (hover: hover) {
	.cc-mobile-cta__btn--secondary:hover {
		background-color: var(--theme-palette-color-5);
		color: var(--theme-palette-color-9) !important;
	}
}

.cc-mobile-cta__btn--secondary .cc-mobile-cta__icon path {
	fill: currentColor;
}