/* UK Dissertation Child — the few rules Tailwind utilities cannot express.
   Colours: UK flag navy #012169 and red #C8102E (and their shades) only. */

/* The child prints its own Free Quote + WhatsApp buttons on every page,
   so the parent's single WhatsApp bubble (home page only) is not doubled. */
.udhc-has-fabs .wafab { display: none !important; }

/* Floating buttons must never sit on top of the last lines of the footer.
   This used to be phone-only, so on a laptop the two buttons covered the
   footer disclaimer ("Get a Free Quote" 123x9px and "Chat on WhatsApp"
   103x9px over it, measured at 1366x900 scrolled to the bottom). */
.udhc-has-fabs body { padding-bottom: 84px; }
@media (max-width: 767px) {
	.udhc-has-fabs body { padding-bottom: 76px; }
}

/* The buttons are fixed, so on a short laptop screen they sat on top of the
   hero's own lines before the reader had scrolled at all — measured covering
   90x22px of a hero sentence on the home page and 99x31px of a post heading
   on /blogs/ at 1366x900. They now fade in once the hero is behind you. */
.udhc-fab { transition: opacity .25s ease, transform .25s ease; }
.udhc-fabs-hidden .udhc-fab {
	opacity: 0;
	transform: translateY(12px);
	pointer-events: none;
}

/* Popup card: slides in from its own side. */
.udhc-card {
	opacity: 0;
	transition: opacity .24s ease, transform .24s ease;
}
.udhc-card.udhc-left  { transform: translateX(-16px); }
.udhc-card.udhc-right { transform: translateX(16px); }
.udhc-card.udhc-in    { opacity: 1; transform: none; }

/* Typing dots in the WhatsApp card. */
.udhc-typing { display: inline-flex; gap: 4px; align-items: center; }
.udhc-typing i {
	width: 6px; height: 6px; border-radius: 50%;
	background: #7f95c7;
	animation: udhcDot 1s infinite ease-in-out;
}
.udhc-typing i:nth-child(2) { animation-delay: .15s; }
.udhc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes udhcDot {
	0%, 80%, 100% { transform: translateY(0); opacity: .45; }
	40%           { transform: translateY(-4px); opacity: 1; }
}

/* The quote form is the parent's own, on one screen, so there are no steps
   to style any more. Only the parent's own hidden-field rule is kept. */
#udh-quote-form [hidden] { display: none !important; }

/* Ticked chapter chips. */
.udh-chip:has(input:checked) { background: #012169; color: #fff; }
.udh-chip:has(input:checked) input { accent-color: #c8102e; }

/* Animated border that crawls round every card (navy + red, UK flag). */
@property --udhc-a {
	syntax: '<angle>';
	inherits: false;
	initial-value: 0deg;
}
.udhc-crawl-b::before,
.udhc-crawl-a::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	padding: 2px;
	/* the travelling light, over a faint resting ring */
	background:
		conic-gradient(from var(--udhc-a),
			transparent 0deg 195deg,
			rgba(200, 16, 46, .35) 250deg,
			#c8102e 295deg,
			#012169 328deg,
			rgba(1, 33, 105, .35) 350deg,
			transparent 360deg),
		linear-gradient(rgba(1, 33, 105, .10), rgba(1, 33, 105, .10));
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	mask-composite: exclude;
	pointer-events: none;
	z-index: 2;
	opacity: 0;
	transition: opacity .4s ease;
}
.udhc-crawl-on.udhc-crawl-b::before,
.udhc-crawl-on.udhc-crawl-a::after {
	opacity: 1;
	animation: udhcCrawl 4.5s linear infinite;
}
@keyframes udhcCrawl { to { --udhc-a: 360deg; } }

/* Inline CTA: soft rise on scroll. */
.udhc-reveal-ready { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.udhc-reveal-ready.udhc-revealed { opacity: 1; transform: none; }

/* New pages (child templates): section reveal. */
.udhp [data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.udhp [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
	.udhc-card { transition: none; animation: none; }
	.udhc-typing i { animation: none; opacity: .8; }
	.udhc-crawl-on.udhc-crawl-b::before, .udhc-crawl-on.udhc-crawl-a::after { animation: none; }
	.udhc-reveal-ready, .udhp [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ---------- Services mega menu, rebuilt ---------- */
/* Three service columns in one row, with the subjects underneath, so the
   whole of what the site offers is visible without scrolling the menu. */
@media (min-width: 900px) {
	/* the parent caps this panel with both width and max-width */
	header .mega.udhc-mega3-wrap {
		width: min(1080px, 95vw) !important;
		max-width: min(1080px, 95vw) !important;
	}
	header .udhc-mega3 {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		gap: 26px !important;
		padding-bottom: 20px !important;
	}
}
header [data-udh-menu="done"] a[aria-current="page"],
header .udhc-subchip[aria-current="page"] { background: #eef1f8; color: #012169 !important; }

header .udhc-megasubjects {
	grid-column: 1 / -1;
	margin-top: 4px;
	padding-top: 16px;
	border-top: 1px solid #e6ebf5;
}
header .udhc-subhead {
	font-family: Sora, system-ui, sans-serif;
	font-weight: 700;
	font-size: 11.5px;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: #0f2461;
	margin-bottom: 11px;
}
header .udhc-subchips { display: flex; flex-wrap: wrap; gap: 7px; }
header a.udhc-subchip {
	display: inline-flex;
	align-items: center;
	padding: 7px 13px;
	border-radius: 999px;
	background: #f4f6fb;
	color: #3a4666;
	font-size: 13.5px;
	font-weight: 600;
	text-decoration: none;
	transition: background .15s ease, color .15s ease;
}
header a.udhc-subchip:hover { background: #012169; color: #fff; }

/* On phones the menu is a stacked drawer, so the row collapses. */
@media (max-width: 899px) {
	header .udhc-subchips { gap: 6px; }
}

/* ---------- Footer: fifth column ---------- */
/* wide screens: five columns in one row */
@media (min-width: 1280px) {
	footer .footgrid.udhc-foot5 {
		grid-template-columns: minmax(0,1.3fr) minmax(0,0.85fr) minmax(0,1.05fr) minmax(0,0.7fr) minmax(0,1.1fr) !important;
		gap: 32px !important;
	}
}
/* laptops: brand block on its own row, the four link columns under it */
@media (min-width: 900px) and (max-width: 1279px) {
	footer .footgrid.udhc-foot5 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 32px !important; }
	footer .footgrid.udhc-foot5 > :first-child { grid-column: 1 / -1; }
}
/* review badges may wrap instead of pushing past the screen edge */
footer .footgrid.udhc-foot5 > :last-child div:has(> a + a) { flex-wrap: wrap !important; }

/* form anchor clears the sticky header */
#quote, #udh-quote-form { scroll-margin-top: 110px; }
