/* ==========================================================================
   Layout: announcement bar, floating glass header, dropdowns, mobile drawer,
   footer, floating WhatsApp button. Markup: header.php / footer.php.
   ========================================================================== */

/* Pages without a dark hero (Tutor dashboard, lesson, default) get top space. */
body:not(.has-hero) .site-main {
	padding-top: calc(var(--header-h) + 32px);
}

/* Offsets for the fixed header: WordPress admin bar + announcement bar. */
body {
	--wp-bar: 0px;
	--announce-h: 0px;
}

body.admin-bar { --wp-bar: 32px; }
@media (max-width: 782px) { body.admin-bar { --wp-bar: 46px; } }
body.has-announce { --announce-h: 40px; }

/* ---- Announcement bar ---- */
.announce {
	position: relative;
	z-index: 60;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: var(--announce-h);
	padding: 6px var(--gutter);
	background: var(--dli-green-600);
	color: #fff;
	font-size: var(--fs-sm);
	font-weight: 600;
	text-align: center;
}

.announce a {
	color: #fff;
	font-weight: 800;
}

/* ---- Header (floating glass pill) ---- */
.site-header {
	position: fixed;
	top: calc(var(--wp-bar) + var(--announce-h) + 12px);
	left: 0;
	right: 0;
	z-index: 50;
	pointer-events: none;
	transition: transform 0.35s var(--ease-out), top var(--dur) var(--ease-out);
}

/* Once the announcement bar has scrolled away, the header moves up to the top. */
.site-header.is-scrolled {
	top: calc(var(--wp-bar) + 12px);
}

.site-header__bar {
	display: flex;
	align-items: center;
	gap: var(--s-4);
	height: 64px;
	padding: 0 10px 0 20px;
	border: 1px solid var(--color-header-border);
	border-radius: var(--r-pill);
	background: var(--color-header-bg);
	backdrop-filter: saturate(1.6) blur(16px);
	-webkit-backdrop-filter: saturate(1.6) blur(16px);
	box-shadow: 0 8px 30px rgb(5 20 12 / 0.12);
	pointer-events: auto;
	transition: height var(--dur) var(--ease-out), box-shadow var(--dur), background-color var(--dur);
}

.site-header.is-scrolled .site-header__bar {
	height: 56px;
	background: var(--color-header-bg-solid);
	box-shadow: 0 10px 34px rgb(5 20 12 / 0.16);
}

.site-header.is-hidden {
	/* Move past its own height plus the top offset so no sliver stays visible. */
	transform: translateY(calc(-100% - var(--wp-bar) - var(--announce-h) - 24px));
}

/* Logo */
.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--color-heading);
	text-decoration: none;
	flex: none;
}

/* Full DLI logo (with "Dream Language Institute") in the white header. */
.brand__logo {
	display: block;
	width: auto;
	height: 50px;
	transition: height var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}

.brand:hover .brand__logo {
	transform: rotate(-2deg) scale(1.03);
}

.site-header.is-scrolled .brand__logo {
	height: 44px;
}

@media (max-width: 520px) {
	.brand__logo { height: 42px; }
}

/* Light / dark logo swap (template-parts/header/brand.php). */
.brand__logo--dark { display: none; }
[data-theme="dark"] .brand__logo--light { display: none; }
[data-theme="dark"] .brand__logo--dark { display: block; }

/* Mark + white wordmark on dark areas (mobile drawer, footer). */
.brand--dark {
	gap: 12px;
}

.brand__mark-img {
	display: block;
	width: auto;
	height: 40px;
}

.brand__text {
	display: grid;
	line-height: 1.15;
}

.brand--dark .brand__text strong {
	color: #fff;
	font-size: 16px;
	font-weight: 800;
	letter-spacing: -0.01em;
}

.brand--dark .brand__text small {
	color: var(--color-on-dark-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
}

/* Primary nav */
.primary-nav {
	margin-left: auto;
}

.primary-nav ul {
	display: flex;
	align-items: center;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.primary-nav a,
.primary-nav .nav-toggle {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 44px;
	padding: 0 14px;
	border: 0;
	border-radius: var(--r-pill);
	background: none;
	color: var(--color-text-2);
	font: 600 var(--fs-sm) / 1 var(--font-sans);
	text-decoration: none;
	cursor: pointer;
	transition: background-color var(--dur-fast), color var(--dur-fast);
}

.primary-nav a:hover,
.primary-nav .nav-toggle:hover,
.primary-nav .current-menu-item > a,
.primary-nav .is-current > a {
	background: var(--color-primary-soft);
	color: var(--color-primary-text);
}

.primary-nav li {
	position: relative;
}

.primary-nav .sub-menu {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	display: grid;
	gap: 2px;
	min-width: 280px;
	padding: 8px;
	border: 1px solid var(--color-border);
	border-radius: var(--r-lg);
	background: var(--color-surface);
	box-shadow: var(--shadow-lg);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), visibility var(--dur);
}

.primary-nav .sub-menu a {
	display: flex;
	width: 100%;
	min-height: 40px;
	padding: 8px 12px;
	border-radius: var(--r-md);
	line-height: 1.35;
}

.primary-nav li:hover > .sub-menu,
.primary-nav li:focus-within > .sub-menu,
.primary-nav li.is-open > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.primary-nav .nav-toggle .icon {
	transition: transform var(--dur) var(--ease-out);
}

.primary-nav li.is-open > .nav-toggle .icon,
.primary-nav li:hover > .nav-toggle .icon {
	transform: rotate(180deg);
}

/* Light / dark toggle (js/ui/theme.js) */
.theme-toggle {
	position: relative;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 1px solid var(--color-border);
	border-radius: 50%;
	background: var(--color-surface);
	color: var(--color-heading);
	cursor: pointer;
	overflow: hidden;
	transition: background-color var(--dur), border-color var(--dur), transform var(--dur-fast) var(--ease-out);
}

.theme-toggle:hover {
	border-color: rgb(0 164 80 / 0.45);
	transform: rotate(-12deg);
}

.theme-toggle .icon {
	grid-area: 1 / 1;
	transition: transform 0.45s var(--ease-out), opacity 0.3s;
}

.theme-toggle__sun { color: var(--dli-amber-300); }
.theme-toggle .theme-toggle__sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
[data-theme="dark"] .theme-toggle .theme-toggle__sun { opacity: 1; transform: none; }
[data-theme="dark"] .theme-toggle .theme-toggle__moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

/* Smooth colour change only while switching (not on every page load). */
.theme-switching,
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, fill 0.3s ease !important;
}

/* Header actions */
.header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: none;
}

.header-actions .btn {
	--btn-h: 44px;
}

.header-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 14px;
	border-radius: var(--r-pill);
	color: var(--color-text-2);
	font-size: var(--fs-sm);
	font-weight: 700;
	text-decoration: none;
}

.header-link:hover {
	background: var(--color-surface-3);
	color: var(--color-heading);
}

.burger {
	display: none;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: var(--color-invert-bg);
	color: var(--color-invert-text);
	cursor: pointer;
}

@media (max-width: 1080px) {
	.primary-nav,
	.header-actions .header-link,
	.header-actions .btn--enroll {
		display: none;
	}
	.burger {
		display: grid;
		margin-left: auto;
	}
	.header-actions {
		margin-left: auto;
	}
}

/* ---- Mobile drawer ---- */
.drawer {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	flex-direction: column;
	padding: 20px var(--gutter) 32px;
	background:
		radial-gradient(70% 50% at 100% 0%, rgb(0 164 80 / 0.35), transparent 60%),
		var(--dli-night-950);
	color: #fff;
	overflow-y: auto;
	visibility: hidden;
	clip-path: circle(0% at calc(100% - 44px) 44px);
	transition: clip-path 0.55s var(--ease-in-out), visibility 0.55s;
}

.drawer.is-open {
	visibility: visible;
	clip-path: circle(150% at calc(100% - 44px) 44px);
}

.drawer__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: var(--s-6);
}

.drawer__close {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border: 1px solid rgb(255 255 255 / 0.2);
	border-radius: 50%;
	background: none;
	color: #fff;
	cursor: pointer;
}

.drawer__nav ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.drawer__nav > ul > li {
	border-bottom: 1px solid rgb(255 255 255 / 0.08);
}

.drawer__nav a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 56px;
	color: #fff;
	font-size: var(--fs-xl);
	font-weight: 700;
	text-decoration: none;
}

.drawer__nav .sub-menu a {
	min-height: 44px;
	padding-left: 16px;
	color: var(--color-on-dark-muted);
	font-size: var(--fs-base);
	font-weight: 600;
}

.drawer__actions {
	display: grid;
	gap: var(--s-3);
	margin-top: auto;
	padding-top: var(--s-6);
}

/* ---- Footer ---- */
.site-footer {
	position: relative;
	padding: clamp(56px, 8vw, 96px) 0 32px;
	background: var(--dli-night-950);
	color: var(--color-on-dark-muted);
	overflow: hidden;
}

.site-footer::before {
	content: "";
	position: absolute;
	inset: auto -10% -60% auto;
	width: 60%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: radial-gradient(circle, rgb(0 164 80 / 0.25), transparent 65%);
	pointer-events: none;
}

.footer-grid {
	position: relative;
	display: grid;
	grid-template-columns: 1.4fr repeat(3, 1fr);
	gap: var(--s-7) var(--s-6);
}

@media (max-width: 900px) {
	.footer-grid { grid-template-columns: 1fr 1fr; }
	.footer-about { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
	.footer-grid { grid-template-columns: 1fr; }
}

.footer-about p {
	max-width: 360px;
	margin-top: var(--s-4);
}

.footer-contact {
	display: grid;
	gap: 10px;
	margin: var(--s-5) 0 0;
	padding: 0;
	list-style: none;
}

.footer-contact li {
	display: flex;
	gap: 10px;
	align-items: flex-start;
}

.footer-contact .icon {
	flex: none;
	margin-top: 3px;
	color: var(--dli-green-300);
}

.site-footer h2 {
	margin-bottom: var(--s-4);
	color: #fff;
	font-size: var(--fs-sm);
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.site-footer ul.footer-links {
	display: grid;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer a {
	color: var(--color-on-dark-muted);
	text-decoration: none;
	transition: color var(--dur-fast);
}

.site-footer a:hover {
	color: #fff;
}

.footer-links a {
	display: inline-flex;
	min-height: 32px;
	align-items: center;
}

.socials {
	display: flex;
	gap: 8px;
	margin-top: var(--s-5);
}

.socials a {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 1px solid rgb(255 255 255 / 0.14);
	border-radius: 50%;
	color: #fff;
	transition: background-color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}

.socials a:hover {
	background: var(--dli-green-600);
	border-color: var(--dli-green-600);
	transform: translateY(-2px);
}

.footer-bottom {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: var(--s-3);
	margin-top: var(--s-8);
	padding-top: var(--s-5);
	border-top: 1px solid rgb(255 255 255 / 0.08);
	font-size: var(--fs-sm);
}

.footer-word {
	position: relative;
	margin: var(--s-7) 0 0;
	color: transparent;
	font-size: clamp(3.5rem, 13vw, 11rem);
	font-weight: 800;
	line-height: 0.85;
	letter-spacing: -0.04em;
	text-align: center;
	-webkit-text-stroke: 1px rgb(255 255 255 / 0.12);
	user-select: none;
}

/* ---- Floating WhatsApp ---- */
.wa-float {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 40;
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #128c4a;
	color: #fff;
	box-shadow: 0 10px 30px rgb(18 140 74 / 0.45);
	transition: transform var(--dur) var(--ease-out);
}

.wa-float:hover {
	color: #fff;
	transform: scale(1.08);
}

.wa-float::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid #128c4a;
	animation: dli-ring 2.4s var(--ease-out) infinite;
}

@keyframes dli-ring {
	from { transform: scale(1); opacity: 0.8; }
	to { transform: scale(1.7); opacity: 0; }
}
