/* =========================================================
   Custom Single Post Template — Exam Updates design
   Only the sidebar and the bottom section are styled here.
   The post content keeps its own Elementor / editor / theme styles.
   ========================================================= */
:root {
	--csp-primary: #557c4c;
	--csp-primary-dark: #426a47;
	--csp-on-primary: #ffffff;
	--csp-heading: #203126;
	--csp-text: #3b4a40;
	--csp-muted: #718078;
	--csp-badge-ink: #365a3b;
	--csp-badge-bg: #eaf3ec;
	--csp-mint: #e4f1e7;
	--csp-mint-light: #edf7f1;
	--csp-line: #d8e2d9;
	--csp-surface: #ffffff;

	--csp-container: 1350px;   /* desktop container width */
	--csp-sidebar: 300px;      /* right sidebar width */
	--csp-gap: 30px;           /* space between content and sidebar */
	--csp-top-space: clamp(100px, calc(var(--ntg-header-height, 82px) + 30px), 120px); /* space for the floating header (desktop) */
	--csp-sticky-offset: 24px; /* gap between the sticky sidebar and the admin bar / sticky header (detected automatically) */
	--csp-radius: 12px;
	--csp-radius-sm: 8px;
}

/* ---------- Theme container reset ----------
   Astra (and similar themes) wrap the page in .ast-container with
   max-width 1240px / 750px, flex and 20px padding. Release it on this
   template so .csp-wrap alone controls the 1350px width. */
body.csp-single-template .site-content > .ast-container,
body.csp-single-template #content > .ast-container {
	display: block !important;
	max-width: none !important;
	width: 100% !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}
/* Astra adds padding/background to single articles via post_class */
.csp-wrap .csp-article {
	padding: 0 !important;
	margin: 0 !important;
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	width: auto !important;
	max-width: none !important;
}

/* ---------- Container: 1350px on desktop ---------- */
.csp-wrap {
	width: 100%;
	flex: 1 1 100%;
	max-width: calc(var(--csp-container) + 40px); /* 1350px content + 20px side padding */
	margin: 0 auto;
	padding: 24px 20px 64px;
	box-sizing: border-box;
}
/* Desktop: start below the floating header */
@media (min-width: 1025px) {
	.csp-wrap { padding-top: var(--csp-top-space); }
}
.csp-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--csp-sidebar);
	gap: var(--csp-gap);
	align-items: start;
}
.csp-main { min-width: 0; }
.csp-sidebar { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* Our own components only (content is left alone) */
.csp-sidebar *, .csp-bottom *, .csp-sidebar *::before, .csp-bottom *::before { box-sizing: border-box; }
.csp-sidebar a, .csp-bottom a { text-decoration: none; }
.csp-sidebar a:focus-visible, .csp-bottom a:focus-visible, .csp-postbar a:focus-visible, .csp-postbar button:focus-visible {
	outline: 2px solid var(--csp-primary); outline-offset: 2px;
}
.csp-ico { flex-shrink: 0; vertical-align: middle; }
.csp-wrap .screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}

/* ---------- Post card (solid white panel around the post) ---------- */
.csp-article-card {
	background: var(--csp-surface);
	border: 1px solid var(--csp-line);
	border-radius: 16px;
	padding: 40px 44px;
	box-shadow: 0 1px 2px rgba(32, 49, 38, .04), 0 12px 32px -12px rgba(32, 49, 38, .12);
}
.csp-article-card > .csp-content > :first-child,
.csp-article-card > :first-child { margin-top: 0; }

/* Title + image: only printed for default-editor posts ('auto' setting) */
.csp-post-title { margin: 0 0 20px; color: var(--csp-heading); }
.csp-post-thumb { margin: 0 0 28px; }
.csp-post-thumb img { display: block; width: 100%; height: auto; border-radius: var(--csp-radius); }
.csp-content { min-width: 0; }
.csp-content::after { content: ""; display: table; clear: both; }

/* ---------- Right sidebar: Exam Categories ---------- */
.csp-box {
	background: var(--csp-surface);
	border: 1px solid var(--csp-line);
	border-radius: var(--csp-radius);
	padding: 18px;
}
.csp-box-head {
	display: flex; gap: 12px; align-items: flex-start;
	padding-bottom: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--csp-line);
}
.csp-box-icon {
	display: grid; place-items: center; flex-shrink: 0;
	width: 40px; height: 40px; border-radius: 10px;
	background: var(--csp-mint); color: var(--csp-primary);
}
.csp-sidebar .csp-box-title { font-size: 18px; line-height: 1.3; margin: 0 0 6px; font-weight: 600; color: var(--csp-heading); }
.csp-box-sub { margin: 0; font-size: 14px; line-height: 1.55; color: var(--csp-muted); }

.csp-catnav { list-style: none; margin: 0; padding: 0; position: relative; display: flex; flex-direction: column; gap: 4px; }
.csp-catnav li { margin: 0; padding: 0; }
.csp-sidebar .csp-catlink {
	display: flex; align-items: center; gap: 10px;
	padding: 10px 10px 10px 12px;
	border-radius: var(--csp-radius-sm);
	border-left: 3px solid transparent;
	color: var(--csp-heading); font-size: 14px; line-height: 1.3;
	transition: background-color .15s ease;
}
.csp-sidebar .csp-catlink:hover { background: var(--csp-badge-bg); color: var(--csp-heading); }
.csp-catlink-ico { color: var(--csp-muted); display: inline-flex; }
.csp-catlink-name { flex: 1; min-width: 0; }
.csp-count {
	min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px;
	display: inline-grid; place-items: center;
	font-size: 11px; font-weight: 600;
	background: var(--csp-badge-bg); color: var(--csp-muted);
}
.csp-sidebar .csp-catlink.is-active {
	background: var(--csp-mint); border-left-color: var(--csp-primary);
	color: var(--csp-primary); font-weight: 600;
}
.csp-catlink.is-active .csp-catlink-ico { color: var(--csp-primary); }
.csp-catlink.is-active .csp-count { background: var(--csp-primary); color: var(--csp-on-primary); }

.csp-sidebar-banner img { display: block; width: 100%; height: auto; border-radius: var(--csp-radius); }
.csp-slot-placeholder {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
	min-height: 200px; padding: 16px; text-align: center;
	border: 1px dashed #bcd2c2; border-radius: var(--csp-radius);
	background: var(--csp-mint); color: var(--csp-muted);
}
.csp-slot-label { font-size: 12px; font-weight: 600; }
.csp-slot-hint { font-size: 11px; max-width: 26ch; }
.csp-widget-title { font-size: 16px; margin: 0 0 10px; color: var(--csp-heading); }

/* ---------- Bottom section ---------- */
.csp-bottom { margin-top: 20px; color: var(--csp-text); }

.csp-postbar {
	display: flex; flex-direction: column; gap: 16px;
	margin-top: 36px; padding-top: 24px;
	border-top: 1px solid var(--csp-line);
}
.csp-postbar *, .csp-postbar *::before { box-sizing: border-box; }
.csp-postbar a { text-decoration: none; }
.csp-dates { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; color: var(--csp-muted); }
.csp-date-item { display: inline-flex; align-items: center; gap: 6px; }
.csp-date-item time { color: var(--csp-heading); font-weight: 600; }
.csp-date-updated, .csp-date-updated time { color: var(--csp-primary); }

.csp-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.csp-postbar .csp-tags a {
	font-size: 13px; padding: 5px 11px; border-radius: 999px;
	border: 1px solid var(--csp-line); color: var(--csp-muted);
}
.csp-postbar .csp-tags a:hover { border-color: var(--csp-primary); color: var(--csp-primary); }

.csp-share { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.csp-share-label { font-weight: 600; color: var(--csp-heading); font-size: 15px; }
.csp-share-list { display: flex; flex-wrap: wrap; gap: 8px; }
.csp-postbar .csp-share-btn {
	display: inline-grid; place-items: center;
	width: 38px; height: 38px; border-radius: 50%; padding: 0; margin: 0;
	border: 1px solid var(--csp-line); background: var(--csp-surface);
	color: var(--csp-primary); cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
.csp-postbar .csp-share-btn:hover { background: var(--csp-primary); border-color: var(--csp-primary); color: var(--csp-on-primary); }
.csp-copy .csp-copy-idle, .csp-copy .csp-copy-done { line-height: 0; }
.csp-copy-done { display: none; }
.csp-copy.is-copied .csp-copy-idle { display: none; }
.csp-copy.is-copied .csp-copy-done { display: inline; }

.csp-author-box {
	display: flex; gap: 18px; align-items: flex-start;
	padding: 22px 24px; margin-bottom: 16px;
	background: var(--csp-mint-light); border: 1px solid var(--csp-line); border-radius: var(--csp-radius);
}
.csp-author-box img { border-radius: 50%; flex-shrink: 0; }
.csp-author-kicker { margin: 0; font-size: 13px; color: var(--csp-muted); }
.csp-bottom .csp-author-name { margin: 2px 0 6px; font-size: 18px; font-weight: 600; color: var(--csp-heading); }
.csp-author-bio { margin: 0 0 8px; font-size: 15px; line-height: 1.6; }
.csp-bottom .csp-text-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; color: var(--csp-primary); }

.csp-bottom-area { margin-bottom: 16px; }

/* Related updates — same cards as the Exam Updates page */
.csp-related { margin: 32px 0 16px; }
.csp-section-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.csp-section-icon {
	display: grid; place-items: center; flex-shrink: 0;
	width: 40px; height: 40px; border-radius: 10px;
	background: var(--csp-mint); color: var(--csp-primary);
}
.csp-bottom .csp-section-title { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; color: var(--csp-heading); }
.csp-section-sub { margin: 4px 0 0; color: var(--csp-muted); font-size: 15px; }

.csp-list { display: flex; flex-direction: column; gap: 10px; }
.csp-card {
	display: grid; grid-template-columns: 156px minmax(0, 1fr) auto; gap: 16px; align-items: center;
	padding: 10px 12px 10px 10px;
	background: var(--csp-surface); border: 1px solid var(--csp-line); border-radius: var(--csp-radius);
	transition: border-color .15s ease;
}
.csp-card:hover { border-color: #bcd2c2; }
.csp-bottom .csp-card-thumb {
	display: grid; place-items: center; overflow: hidden;
	aspect-ratio: 16 / 10; border-radius: var(--csp-radius-sm);
	background: var(--csp-mint); color: var(--csp-primary);
}
.csp-bottom .csp-card-thumb { position: relative; width: 100%; }
.csp-card-thumb img,
.csp-card-thumb .csp-card-img {
	position: absolute; inset: 0;
	width: 100% !important; height: 100% !important; max-width: none !important;
	object-fit: cover; display: block; margin: 0 !important; border-radius: 0;
	transition: transform .3s ease;
}
.csp-card:hover .csp-card-thumb img { transform: scale(1.04); }
.csp-card-body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.csp-bottom .csp-badge {
	display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
	padding: 4px 8px; border-radius: 4px; background: var(--csp-badge-bg); color: var(--csp-badge-ink);
}
.csp-bottom .csp-card-title { margin: 2px 0 0; font-size: 17px; line-height: 1.35; font-weight: 600; }
.csp-bottom .csp-card-title a { color: var(--csp-heading); }
.csp-bottom .csp-card-title a:hover { color: var(--csp-primary); }
.csp-card-excerpt {
	margin: 0; font-size: 14px; line-height: 1.55; color: var(--csp-muted);
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.csp-card-date { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--csp-muted); }

.csp-bottom .csp-btn {
	display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
	padding: 9px 16px; border-radius: 6px;
	font-size: 13px; font-weight: 600; line-height: 1.2;
	border: 1px solid var(--csp-line); background: var(--csp-surface); color: var(--csp-primary);
	transition: background-color .15s ease, color .15s ease;
}
.csp-bottom .csp-btn:hover { background: var(--csp-primary); border-color: var(--csp-primary); color: var(--csp-on-primary); }

.csp-post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.csp-bottom .csp-post-nav a {
	display: flex; flex-direction: column; gap: 4px;
	padding: 14px 16px; border: 1px solid var(--csp-line); border-radius: var(--csp-radius);
	background: var(--csp-surface); color: var(--csp-heading);
}
.csp-bottom .csp-post-nav a:hover { border-color: var(--csp-primary); }
.csp-post-nav .csp-nav-next { grid-column: 2; text-align: right; align-items: flex-end; }
.csp-nav-label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--csp-muted); }
.csp-nav-title { font-weight: 600; font-size: 15px; line-height: 1.4; }

.csp-comments {
	padding: 24px 28px; background: var(--csp-surface);
	border: 1px solid var(--csp-line); border-radius: var(--csp-radius);
}

/* ---------- Sticky sidebar (desktop only) ----------
   JS sets --csp-sticky-top: sticks at the top when the sidebar fits the screen,
   or sticks by its bottom edge when it is taller than the screen, so nothing gets cut off. */
@media (min-width: 1025px) {
	.csp-sidebar {
		position: sticky;
		top: var(--csp-sticky-top, var(--csp-sticky-offset));
		align-self: start;
	}
}

/* ---------- Tablet & mobile ---------- */
@media (max-width: 1024px) {
	.csp-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
	/* Categories move above the post as a scrolling pill row */
	.csp-sidebar { order: -1; }
	.csp-cats-box { padding: 8px; }
	.csp-cats-box .csp-box-head, .csp-sidebar-banner { display: none; }
	.csp-catnav {
		flex-direction: row; gap: 8px; overflow-x: auto;
		scrollbar-width: none; -webkit-overflow-scrolling: touch;
	}
	.csp-catnav::-webkit-scrollbar { display: none; }
	.csp-sidebar .csp-catlink {
		border: 1px solid var(--csp-line); border-radius: 999px;
		padding: 8px 14px; white-space: nowrap; font-size: 13px;
	}
	.csp-catlink-ico, .csp-catnav .csp-count { display: none; }
	.csp-sidebar .csp-catlink.is-active { background: var(--csp-primary); border-color: var(--csp-primary); color: var(--csp-on-primary); }
}
@media (max-width: 1024px) {
	.csp-article-card { padding: 28px 28px; }
}
@media (max-width: 640px) {
	.csp-wrap { padding: 16px 14px 48px; }
	.csp-article-card { padding: 22px 18px; border-radius: 12px; }
	.csp-card { grid-template-columns: 96px minmax(0, 1fr); }
	.csp-card-btn { grid-column: 1 / -1; justify-content: center; }
	.csp-card-excerpt { display: none; }
	.csp-post-nav { grid-template-columns: 1fr; }
	.csp-post-nav .csp-nav-next { grid-column: 1; text-align: left; align-items: flex-start; }
	.csp-author-box { flex-direction: column; }
	.csp-share { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
	.csp-sidebar *, .csp-bottom * { transition: none !important; }
}
