/*
 * ExamNeed extras: layout, sticky header, mobile switches,
 * notification bar and footer social links.
 * Switched on by body classes (see inc/extras.php).
 */

/* ==========================================================
   Sidebar position
   ========================================================== */
@media (min-width: 801px) {
	body.sidebar-left .content-area,
	body.sidebar-left .content-area.has-left-sidebar {
		grid-template-columns: 300px minmax(0, 1fr);
	}

	body.sidebar-left .content-area > .sidebar {
		order: -1;
	}
}

body.sidebar-none .content-area,
body.sidebar-none .content-area.has-left-sidebar {
	grid-template-columns: minmax(0, 1fr);
}

body.sidebar-none .content-area > .sidebar,
body.sidebar-none .content-area > .sidebar-left {
	display: none;
}

/* ==========================================================
   Sticky header
   ========================================================== */
@media (min-width: 801px) {
	body.sticky-desktop .site-header {
		position: sticky;
		top: 0;
		z-index: 100;
	}

	body.sticky-desktop.admin-bar .site-header {
		top: 32px;
	}
}

@media (max-width: 800px) {
	body.sticky-mobile .site-header {
		position: sticky;
		top: 0;
		z-index: 100;
	}

	body.sticky-mobile.admin-bar .site-header {
		top: 46px;
	}

	/* Mobile switches */
	body.no-mobile-pills .pill-nav {
		display: none;
	}

	body.show-mobile-secondary .secondary-navigation,
	body.show-mobile-secondary.header-style-app .secondary-navigation,
	body.show-mobile-secondary.header-style-navy .secondary-navigation {
		display: block !important;
	}

	body.no-mobile-tagline .site-tagline {
		display: none !important;
	}

	body.no-mobile-ticker .news-ticker {
		display: none;
	}
}

/* ==========================================================
   Notification bar
   ========================================================== */
.notice-bar {
	background: var(--c-accent);
	color: #fff;
	font-size: 14px;
	line-height: 1.4;
}

.notice-bar[hidden] {
	display: none;
}

.notice-bar-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px 14px;
	padding-top: 8px;
	padding-bottom: 8px;
	text-align: center;
}

.notice-bar-text {
	font-weight: 600;
}

.notice-bar-link {
	color: #fff;
	font-weight: 700;
	text-decoration: underline;
	white-space: nowrap;
}

.notice-bar-close {
	flex: 0 0 auto;
	width: 28px;
	height: 28px;
	margin-left: auto;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.notice-bar-close:hover {
	background: rgba(255, 255, 255, 0.35);
}

@media (max-width: 600px) {
	.notice-bar-inner {
		flex-wrap: wrap;
		justify-content: flex-start;
		text-align: left;
		padding-right: 44px;
		position: relative;
	}

	.notice-bar-close {
		position: absolute;
		top: 6px;
		right: 12px;
	}
}

/* ==========================================================
   Footer social links
   ========================================================== */
.footer-social {
	padding: 14px 0;
	border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-social-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
}

.footer-social-label {
	margin-right: 4px;
	font-weight: 600;
}

.footer-social a {
	padding: 6px 14px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 999px;
	color: inherit;
	font-size: 13.5px;
	font-weight: 600;
}

.footer-social a:hover,
.footer-social a:focus {
	background: rgba(255, 255, 255, 0.15);
	text-decoration: none;
}

@media print {
	.notice-bar {
		display: none;
	}
}

/* ---- Safety nets: no sideways scrolling, clear keyboard focus, loading ---- */
html,
body {
	max-width: 100%;
	overflow-x: clip; /* clip (not hidden) keeps sticky headers working */
}

img,
video,
iframe,
embed,
object,
svg {
	max-width: 100%;
}

.entry-content,
.entry-title,
.post-card,
.widget {
	overflow-wrap: break-word;
}

.entry-content pre,
.entry-content code {
	max-width: 100%;
	overflow-x: auto;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
	outline: 3px solid var(--c-accent, #e8590c);
	outline-offset: 2px;
}

/* Loading state for the search form after pressing search. */
form.is-loading {
	opacity: .7;
	pointer-events: none;
}

form.is-loading button[type="submit"],
form.is-loading input[type="submit"] {
	cursor: progress;
}

form.is-loading button[type="submit"]::after {
	content: "";
	display: inline-block;
	width: .9em;
	height: .9em;
	margin-left: .5em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	vertical-align: -.1em;
	animation: exn-spin .7s linear infinite;
}

@keyframes exn-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	form.is-loading button[type="submit"]::after { animation: none; }
}

/* Breadcrumbs */
.breadcrumbs { margin: 0 0 10px; font-size: 12.5px; color: var(--c-muted); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumbs li + li::before { content: "\203A"; margin: 0 6px; opacity: .6; }
.breadcrumbs a { color: var(--c-muted); text-decoration: none; }
.breadcrumbs a:hover, .breadcrumbs a:focus { color: var(--c-primary, #0b57d0); text-decoration: underline; }
.breadcrumbs [aria-current] span { color: var(--c-text); font-weight: 600; }
@media (max-width: 600px) { .breadcrumbs { font-size: 11.5px; } }

/* ==========================================================
   Flat white pages (home and posts): no separate boxes.
   Switch: ExamNeed Options > Colours & Design > "Flat white pages".
   The white page background itself is printed by inc/extras.php so
   dark mode keeps its own colours.
   ========================================================== */
body.flat-pages.home .home-intro,
body.flat-pages.home .home-card,
body.flat-pages.single .single-article,
body.flat-pages.single .related-posts,
body.flat-pages.single .widget,
body.flat-pages.home .widget {
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

body.flat-pages.home .home-intro,
body.flat-pages.home .home-card,
body.flat-pages.single .single-article {
	padding-right: 0;
	padding-left: 0;
}

body.flat-pages.single .single-article {
	padding-top: 6px;
}

/* A thin line and space separate sections instead of boxes. */
body.flat-pages.home .home-card,
body.flat-pages.single .related-posts,
body.flat-pages.single .widget,
body.flat-pages.home .widget {
	margin-bottom: 0;
	padding-top: 20px;
	padding-bottom: 20px;
	border-top: 1px solid var(--c-border);
}

body.flat-pages.home .home-intro {
	padding-top: 6px;
	padding-bottom: 14px;
}

body.flat-pages.single .widget,
body.flat-pages.home .widget {
	padding-right: 0;
	padding-left: 0;
}

body.flat-pages.single .post-navigation a {
	box-shadow: none;
}

@media (max-width: 600px) {
	body.flat-pages.single .single-article,
	body.flat-pages.home .home-card,
	body.flat-pages.home .home-intro {
		padding-right: 2px;
		padding-left: 2px;
	}
}
