/**
 * Dreams4Jamaica — responsive navigation fixes.
 * Loaded site-wide by the mu-plugin in this folder.
 *
 * Breakpoints
 *   1100px and up : horizontal menu (fluid so 11 items always fit)
 *   up to 1099px  : off-canvas drawer (theme only did this at 768px)
 */

/* ------------------------------------------------------------------
 * 1. Structure: nothing wraps, nothing overflows its container.
 * ---------------------------------------------------------------- */
#dreams-navbar .dreams-nav-inner {
	gap: 12px;
	min-width: 0;
}

#dreams-navbar .dreams-nav-logo {
	flex: 0 1 auto;
	min-width: 0;
}

#dreams-navbar .dreams-nav-menu {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	min-width: 0;
	flex: 0 1 auto;
}

#dreams-navbar .dreams-nav-menu,
#dreams-navbar .dreams-nav-menu li,
#dreams-navbar .dreams-nav-menu a,
#dreams-navbar .dreams-nav-menu a span {
	white-space: nowrap;
}

/* ------------------------------------------------------------------
 * 2. Desktop / large tablet: fluid type and padding so the nine
 *    links plus the CTA fit inside the 1300px container at any width.
 *    Only applies once the portal links are in the menu, so the
 *    original spacing is untouched while the portal is inactive.
 * ---------------------------------------------------------------- */
@media (min-width: 1100px) {
	#dreams-navbar .dreams-nav-inner {
		padding: 14px 20px;
		gap: 10px;
	}

	#dreams-navbar .dreams-nav-menu {
		gap: 0;
	}

	#dreams-navbar:has(.d4j-nav-schools) .dreams-nav-menu a {
		padding: 9px clamp(5px, 0.42vw, 13px);
		font-size: clamp(0.66rem, 0.2vw + 0.56rem, 0.78rem);
		letter-spacing: clamp(0.1px, 0.03vw, 0.5px);
	}

	#dreams-navbar:has(.d4j-nav-schools) .dreams-nav-cta {
		padding: 9px clamp(9px, 0.55vw, 18px) !important;
		font-size: clamp(0.64rem, 0.2vw + 0.54rem, 0.74rem) !important;
		margin-left: 4px;
	}

	#dreams-navbar .dreams-logo-name {
		font-size: clamp(1.05rem, 0.9vw + 0.62rem, 1.35rem);
	}

	#dreams-navbar .dreams-logo-icon {
		width: clamp(44px, 4.2vw, 52px);
		height: clamp(44px, 4.2vw, 52px);
	}

	#dreams-navbar .dreams-logo-tag {
		font-size: clamp(0.48rem, 0.55vw, 0.62rem);
		letter-spacing: clamp(0.6px, 0.14vw, 2px);
	}
}

/* ------------------------------------------------------------------
 * 3. Tablets and phones: off-canvas drawer.
 * ---------------------------------------------------------------- */
@media (max-width: 1099px) {
	#dreams-navbar .dreams-nav-inner {
		position: relative;
		padding: 12px 16px;
		gap: 12px;
	}

	#dreams-navbar .dreams-hamburger {
		display: flex;
		position: absolute;
		right: 16px;
		top: 50%;
		transform: translateY(-50%);
		z-index: 10002;
	}

	#dreams-navbar .dreams-nav-menu {
		position: fixed;
		top: 0;
		left: -100%;
		width: min(340px, 86vw);
		height: 100vh;
		height: 100dvh;
		margin: 0;
		padding: 86px 22px 32px;
		display: flex;
		flex-direction: column;
		align-items: stretch;
		gap: 4px;
		background: var(--white, #fff);
		box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		z-index: 10001;
		transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	}

	#dreams-navbar .dreams-nav-menu.open {
		left: 0;
	}

	#dreams-navbar .dreams-nav-menu li {
		width: 100%;
		margin: 0;
		padding: 0;
	}

	#dreams-navbar .dreams-nav-menu a {
		width: 100%;
		padding: 14px 16px;
		font-size: 0.92rem;
		border-radius: 10px;
	}

	#dreams-navbar .dreams-nav-menu a::after {
		display: none;
	}

	#dreams-navbar .dreams-nav-cta {
		margin-top: 10px;
		padding: 14px 18px !important;
		border-radius: 10px !important;
		justify-content: center;
		font-size: 0.85rem !important;
		text-align: center;
	}

	#dreams-navbar .dreams-nav-menu li:last-child {
		margin-bottom: 12px;
	}

	/* While the drawer is open, lift the navbar above the cookie banner
	   (z-index 99999) so the drawer and its dim overlay are not covered. */
	body:has(#dreams-navbar .dreams-nav-menu.open) #dreams-navbar {
		z-index: 100000;
	}

	body:has(#dreams-cookie-banner.show) #dreams-navbar .dreams-nav-menu {
		padding-bottom: 32px;
	}
}

/* ------------------------------------------------------------------
 * 4. Phones.
 * ---------------------------------------------------------------- */
@media (max-width: 600px) {
	#dreams-navbar .dreams-nav-inner {
		padding: 10px 14px;
		gap: 10px;
	}
	#dreams-navbar .dreams-logo-icon {
		width: 44px;
		height: 44px;
	}
	#dreams-navbar .dreams-logo-name {
		font-size: 1.05rem;
		letter-spacing: -0.3px;
	}
	#dreams-navbar .dreams-logo-tag {
		font-size: 0.5rem;
		letter-spacing: 1.1px;
	}
	#dreams-navbar .dreams-hamburger {
		right: 12px;
		padding: 6px;
	}
	#dreams-navbar .dreams-nav-menu {
		width: min(320px, 88vw);
		padding: 80px 18px 28px;
	}
}

@media (max-width: 380px) {
	#dreams-navbar .dreams-logo-name {
		font-size: 0.95rem;
	}
	#dreams-navbar .dreams-logo-tag {
		display: none;
	}
	#dreams-navbar .dreams-hamburger {
		right: 8px;
	}
}

/* ------------------------------------------------------------------
 * 5. Dark mode keeps the drawer readable (the theme switches the
 *    navbar surface to white, so force dark text on menu links).
 * ---------------------------------------------------------------- */
body.dark-mode #dreams-navbar .dreams-nav-menu {
	background: var(--white, #fff);
}
body.dark-mode #dreams-navbar .dreams-nav-menu a {
	color: var(--black, #1A1A1A);
}
body.dark-mode #dreams-navbar .dreams-nav-menu a:hover,
body.dark-mode #dreams-navbar .dreams-nav-menu a.active {
	color: var(--green, #009B3A);
	background: rgba(0, 155, 58, 0.08);
}
body.dark-mode #dreams-navbar .dreams-nav-cta,
body.dark-mode #dreams-navbar .dreams-nav-cta:hover {
	color: #fff !important;
}

/* ------------------------------------------------------------------
 * 6. No sideways scrolling.
 *    The theme's AOS start positions (data-aos="fade-left/right")
 *    translate elements outside the viewport before they animate in,
 *    which produces a horizontal scrollbar. Clip it at page level;
 *    `clip` keeps position: sticky working.
 * ---------------------------------------------------------------- */
html,
body {
	overflow-x: hidden;
}

@supports (overflow-x: clip) {
	html,
	body {
		overflow-x: clip;
	}
}
