/* =========================================================================
   Saving Grace AI — presentation layer
   Design tokens read directly from the live savinggraceaitutor.co.za
   :root block, so colours, type and radii match the existing site exactly
   rather than being approximated from the brand guide.

   Mobile-first. No framework, no resets beyond what is needed, no JS
   dependency for layout. ~18KB uncompressed — replaces the ~3MB runtime
   Tailwind Play CDN build the current site ships.
   ====================================================================== */

:root {
	/* Exact tokens read from the live site's :root — do not guess these. */
	--sg-navy:        #26358C;
	--sg-navy-deep:   #1B2766;
	--sg-navy-soft:   #E8EAF3;
	--sg-cyan:        #26BBC1;
	--sg-cyan-soft:   #DDF2F3;
	--sg-cyan-deep:   #1B9AA0;
	--sg-red:         #E31A51;
	--sg-red-soft:    #FBE3EA;
	--sg-yellow:      #F9BE00;
	--sg-yellow-soft: #FEF4CC;
	--sg-yellow-ink:  #8C6A00;
	--sg-grey-light:  #F2F2F2;
	--sg-grey-warm:   #F7F8FB;
	--sg-ink:         #0F1230;
	--sg-ink-mid:     #4A4F75;
	--sg-ink-light:   #8A8FAE;
	--sg-hairline:    #E5E7EB;
	--sg-white:       #FFFFFF;

	/* Aliases kept so older rules and the block editor keep working. */
	--sg-blue:   var(--sg-navy);
	--sg-body:   var(--sg-ink-mid);
	--sg-action: var(--sg-red);
	--sg-tint:   var(--sg-cyan-soft);
	--sg-grey:   var(--sg-grey-light);

	--sg-shadow-sm: 0 2px 12px rgba(27,39,102,.05);
	--sg-shadow-md: 0 14px 38px rgba(27,39,102,.09);
	--sg-shadow-lg: 0 24px 64px rgba(27,39,102,.14);
	--sg-shadow-red:  0 10px 26px rgba(227,26,81,.28);
	--sg-shadow-navy: 0 10px 28px rgba(38,53,140,.28);

	--sg-font-head:  Poppins, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	--sg-font-body:  Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	--sg-font-serif: "Noto Serif", Georgia, "Times New Roman", serif;
	--sg-font-mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

	--sg-wrap: 840px;
	--sg-wide: 1200px;
	--sg-gutter: 24px;
	--sg-radius: 12px;
	--sg-radius-pill: 9999px;
	--sg-header-h: 79px;
	--sg-section-y: 56px;
}

@media (min-width: 768px) {
	:root { --sg-section-y: 82px; }
}

/* -------------------------------------------------- base --------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Keep anchored headings clear of the sticky header. */
	scroll-padding-top: calc(var(--sg-header-h) + 16px);
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}

body {
	margin: 0;
	font-family: var(--sg-font-body);
	font-size: 16px;
	line-height: 1.65;
	color: var(--sg-ink-mid);
	background: var(--sg-white);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--sg-font-head);
	color: var(--sg-navy);
	font-weight: 600;
	line-height: 1.1;
	letter-spacing: -.025em;
	margin: 0 0 .7rem;
}

h1 { font-size: clamp(2.1rem, 4.6vw, 2.875rem); }   /* 46px at desktop */
h2 { font-size: clamp(1.75rem, 4.2vw, 2.75rem); margin-top: 3rem; }  /* 44px */
h3 { font-size: 1.25rem; line-height: 1.25; letter-spacing: -.01em; color: var(--sg-ink); margin-top: 1.9rem; }
h4 { font-size: 1.05rem; letter-spacing: -.01em; color: var(--sg-ink); }

p, ul, ol { margin: 0 0 1.15rem; }
strong, b { color: var(--sg-ink); font-weight: 600; }

a { color: var(--sg-blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }

img, svg, video, iframe { max-width: 100%; height: auto; }
img { display: block; }

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid var(--sg-cyan);
	outline-offset: 2px;
	border-radius: 4px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}

.sg-skip {
	position: absolute; left: -9999px;
	top: 0; z-index: 999;
	background: var(--sg-ink); color: #fff;
	padding: 12px 20px; border-radius: 0 0 8px 0;
	font-weight: 600; text-decoration: none;
}
.sg-skip:focus { left: 0; }

/* -------------------------------------------------- layout ------------- */

.sg-wrap {
	max-width: var(--sg-wrap);
	margin-inline: auto;
	padding-inline: var(--sg-gutter);
}

.sg-main { display: block; }

.alignwide  { max-width: var(--sg-wide); margin-inline: auto; }
.alignfull  { max-width: none; }

/* -------------------------------------------------- header ------------- */

.sg-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--sg-white);
	border-bottom: 1px solid var(--sg-hairline);
}

.sg-header__inner {
	max-width: var(--sg-wide);
	margin-inline: auto;
	padding-inline: var(--sg-gutter);
	min-height: var(--sg-header-h);
	display: flex;
	align-items: center;
	gap: 20px;
}

.sg-brand { margin-right: auto; display: flex; align-items: center; }
.sg-brand img { max-height: 42px; width: auto; height: auto; display: block; }
.sg-brand .custom-logo-link { display: flex; align-items: center; }
.sg-brand .custom-logo { max-height: 42px; width: auto; height: auto; }
@media (max-width: 480px) { .sg-brand img, .sg-brand .custom-logo { max-height: 34px; } }

.sg-brand__text {
	font-family: var(--sg-font-head);
	font-weight: 700;
	font-size: 1.06rem;
	letter-spacing: -.02em;
	color: var(--sg-blue);
	text-decoration: none;
	white-space: nowrap;
}
.sg-brand__text:hover { text-decoration: none; }

.sg-burger {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px; height: 44px;
	padding: 10px;
	background: none;
	border: 1px solid var(--sg-hairline);
	border-radius: 9px;
	cursor: pointer;
}
.sg-burger span {
	display: block; height: 2px; width: 100%;
	background: var(--sg-ink); border-radius: 2px;
	transition: transform .18s ease, opacity .18s ease;
}
.sg-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sg-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.sg-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sg-nav {
	display: none;
	position: absolute;
	inset: var(--sg-header-h) 0 auto 0;
	background: var(--sg-white);
	border-bottom: 1px solid var(--sg-hairline);
	padding: 12px var(--sg-gutter) 20px;
	box-shadow: 0 14px 28px rgba(16,18,46,.08);
}
.sg-nav.is-open { display: block; }

.sg-nav__list { list-style: none; margin: 0; padding: 0; }
.sg-nav__list li { border-bottom: 1px solid var(--sg-hairline); }
.sg-nav__list li:last-child { border-bottom: 0; }
.sg-nav__list a {
	display: block;
	padding: 13px 2px;
	color: var(--sg-body);
	text-decoration: none;
	font-weight: 500;
	font-size: .96rem;
}
.sg-nav__list a:hover,
.sg-nav__list .current-menu-item > a { color: var(--sg-blue); }

.sg-nav__actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 16px;
}
.sg-nav__login {
	color: var(--sg-body);
	text-decoration: none;
	font-weight: 500;
	font-size: .93rem;
	padding: 6px 2px;
}

@media (min-width: 900px) {
	.sg-burger { display: none; }
	.sg-nav {
		display: flex;
		position: static;
		align-items: center;
		gap: 4px;
		padding: 0;
		border: 0;
		box-shadow: none;
		background: none;
	}
	.sg-nav__list { display: flex; align-items: center; gap: 4px; }
	.sg-nav__list li { border: 0; }
	.sg-nav__list a { padding: 8px 12px; }
	.sg-nav__actions { flex-direction: row; align-items: center; gap: 14px; margin: 0 0 0 14px; }
}

/* -------------------------------------------------- buttons ------------ */

.sg-btn {
	display: inline-block;
	padding: 14px 26px;
	border: 1.5px solid transparent;
	border-radius: var(--sg-radius-pill);
	font-family: var(--sg-font-head);
	font-weight: 600;
	font-size: 15px;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.sg-btn:hover { text-decoration: none; transform: translateY(-1px); }

.sg-btn--primary {
	background: var(--sg-red);
	color: #fff;
	box-shadow: var(--sg-shadow-red);
}
.sg-btn--primary:hover { background: #C4173F; color: #fff; }

.sg-btn--navy {
	background: var(--sg-navy);
	color: #fff;
	padding: 16px 30px;
	font-size: 16px;
	letter-spacing: -.01em;
	box-shadow: var(--sg-shadow-navy);
}
.sg-btn--navy:hover { background: var(--sg-navy-deep); color: #fff; }

.sg-btn--ghost {
	background: transparent;
	color: var(--sg-navy);
	border-color: var(--sg-hairline);
}
.sg-btn--ghost:hover { background: var(--sg-navy-soft); border-color: var(--sg-navy-soft); }

/* On dark backgrounds (the footer CTA band). */
.sg-btn--onDark {
	background: transparent;
	color: #fff;
	border-color: rgba(255,255,255,.3);
}
.sg-btn--onDark:hover { background: rgba(255,255,255,.1); color: #fff; }

.sg-nav__cta { padding: 10px 18px; font-size: .9rem; }

/* Core button block picks up the same treatment via theme.json; this covers
   the outline style variation. */
.wp-block-button__link { border-radius: var(--sg-radius-pill); box-shadow: var(--sg-shadow-red); }
.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--sg-navy);
	border: 1.5px solid var(--sg-hairline);
	box-shadow: none;
}
.wp-block-button.is-style-outline .wp-block-button__link:hover { background: var(--sg-navy-soft); }

/* -------------------------------------------------- page head ---------- */

.sg-pagehead {
	background: linear-gradient(180deg, var(--sg-grey-warm) 0%, #fff 100%);
	border-bottom: 1px solid var(--sg-hairline);
	padding: 48px 0 34px;
	margin-bottom: 30px;
}
.sg-pagehead .sg-wrap { max-width: var(--sg-wrap); }
.sg-pagehead__title { margin-bottom: 0; }
.sg-pagehead__desc { margin-top: .8rem; }

.sg-eyebrow {
	font-family: var(--sg-font-mono);
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--sg-cyan-deep);
	margin: 0 0 12px;
}

.sg-crumbs { margin: 0 0 18px; font-size: .82rem; }
.sg-crumbs ol {
	list-style: none; margin: 0; padding: 0;
	display: flex; flex-wrap: wrap; gap: 6px;
}
.sg-crumbs li + li::before { content: "\203A"; margin-right: 6px; opacity: .55; }
.sg-crumbs a { color: var(--sg-body); text-decoration: none; }
.sg-crumbs a:hover { color: var(--sg-blue); text-decoration: underline; }
.sg-crumbs [aria-current] { opacity: .7; }

.sg-featured {
	margin: 0 auto 34px;
	max-width: var(--sg-wide);
	padding-inline: var(--sg-gutter);
}
.sg-featured img { width: 100%; border-radius: var(--sg-radius); }

/* -------------------------------------------------- content ------------ */

.sg-content { padding-bottom: 50px; }

.sg-content ul:not(.sg-list):not(.sg-nav__list) { padding-left: 0; list-style: none; }
.sg-content ul:not(.sg-list):not(.sg-nav__list) > li {
	position: relative;
	padding-left: 26px;
	margin-bottom: .7rem;
}
.sg-content ul:not(.sg-list):not(.sg-nav__list) > li::before {
	content: "";
	position: absolute; left: 4px; top: .62em;
	width: 7px; height: 7px;
	border-radius: 50%;
	background: var(--sg-cyan);
}

.sg-content ol { padding-left: 1.3rem; }
.sg-content ol li { margin-bottom: .6rem; }

.sg-list { list-style: none; margin: 0 0 1.4rem; padding: 0; }
.sg-list li { margin-bottom: .55rem; }

blockquote, .wp-block-quote {
	margin: 1.6rem 0;
	padding: 20px 24px;
	background: var(--sg-tint);
	border-left: 4px solid var(--sg-cyan);
	border-radius: 0 var(--sg-radius) var(--sg-radius) 0;
}
blockquote p, .wp-block-quote p {
	margin: 0;
	font-family: var(--sg-font-serif);
	font-style: italic;
	font-size: 1.03rem;
	color: var(--sg-ink);
}
blockquote cite { font-style: normal; font-size: .88rem; color: var(--sg-body); }

/* Tables — navy framed, horizontally scrollable on small screens. */
.wp-block-table { overflow-x: auto; margin: 0 0 1.6rem; }
.wp-block-table table,
.sg-content table {
	border-collapse: collapse;
	width: 100%;
	min-width: 460px;
	font-size: .94rem;
	border: 1px solid var(--sg-navy);
	border-radius: var(--sg-radius);
	overflow: hidden;
}
.sg-content th {
	background: var(--sg-navy);
	color: #fff;
	text-align: left;
	padding: 13px 16px;
	font-family: var(--sg-font-head);
	font-weight: 600;
	font-size: .88rem;
}
.sg-content td {
	padding: 12px 16px;
	border-top: 1px solid var(--sg-hairline);
	vertical-align: top;
}
.sg-content tbody tr:nth-child(even) { background: #FAFAFC; }

code, pre {
	font-family: var(--sg-font-mono);
	font-size: .9em;
	background: var(--sg-grey);
	border-radius: 5px;
}
code { padding: 2px 6px; }
pre { padding: 16px; overflow-x: auto; }

hr, .wp-block-separator {
	border: 0;
	border-top: 1px solid var(--sg-hairline);
	margin: 2.4rem 0;
}

/* -------------------------------------------------- FAQ ---------------- */

.sg-faq { margin: 1rem 0 2rem; }

.sg-faq details {
	border: 1px solid var(--sg-hairline);
	border-radius: var(--sg-radius);
	margin-bottom: 10px;
	background: #fff;
}
.sg-faq details[open] { border-color: var(--sg-cyan); }

.sg-faq summary {
	cursor: pointer;
	padding: 15px 20px;
	font-family: var(--sg-font-head);
	font-weight: 600;
	font-size: 1rem;
	color: var(--sg-ink);
	list-style: none;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px;
}
.sg-faq summary::-webkit-details-marker { display: none; }
.sg-faq summary::after {
	content: "+";
	color: var(--sg-cyan);
	font-size: 1.4rem;
	line-height: 1;
	flex-shrink: 0;
}
.sg-faq details[open] summary::after { content: "\2212"; }

.sg-faq__a { padding: 0 20px 17px; font-size: .97rem; }
.sg-faq__a p:last-child { margin-bottom: 0; }

/* -------------------------------------------------- cards -------------- */

.sg-cards {
	display: grid;
	gap: 26px;
	grid-template-columns: 1fr;
	margin-bottom: 40px;
}
@media (min-width: 700px)  { .sg-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .sg-cards { grid-template-columns: repeat(3, 1fr); } }

.sg-card {
	border: 1px solid var(--sg-hairline);
	border-radius: 20px;
	overflow: hidden;
	background: #fff;
	display: flex;
	flex-direction: column;
	transition: border-color .15s ease, transform .15s ease;
}
.sg-card:hover { border-color: var(--sg-cyan); transform: translateY(-2px); box-shadow: var(--sg-shadow-md); }

.sg-card__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.sg-card__body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.sg-card__title { font-size: 1.1rem; margin: 0 0 .5rem; line-height: 1.32; }
.sg-card__title a { color: var(--sg-ink); text-decoration: none; }
.sg-card__title a:hover { color: var(--sg-blue); }
.sg-card__excerpt { font-size: .93rem; margin-bottom: 1rem; }
.sg-card__meta { font-size: .8rem; opacity: .7; margin: auto 0 0; }

/* -------------------------------------------------- endcap ------------- */

.sg-endcap {
	margin-top: 3.4rem;
	padding: 34px;
	border: 1px solid var(--sg-hairline);
	border-radius: 20px;
	background: var(--sg-grey-warm);
	box-shadow: var(--sg-shadow-sm);
}
.sg-endcap h2 { margin-top: 0; }
.sg-endcap > :last-child { margin-bottom: 0; }

/* -------------------------------------------------- search / nav ------- */

.sg-search { display: flex; gap: 10px; margin: 0 0 2rem; flex-wrap: wrap; }
.sg-search input[type="search"] {
	flex: 1 1 220px;
	padding: 12px 16px;
	border: 1px solid var(--sg-hairline);
	border-radius: 9px;
	font: inherit;
	font-size: .95rem;
	color: var(--sg-ink);
}
.sg-search input[type="search"]:focus { border-color: var(--sg-cyan); }

.sg-postnav {
	display: flex;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
	padding: 24px 0 40px;
	border-top: 1px solid var(--sg-hairline);
	font-size: .93rem;
}
.sg-postnav a { text-decoration: none; font-weight: 500; }

.wp-block-post-comments,
.comment-respond { margin-bottom: 50px; }

.navigation.pagination { margin: 0 0 50px; }
.nav-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 40px; height: 40px; padding: 0 12px;
	border: 1px solid var(--sg-hairline);
	border-radius: 9px;
	text-decoration: none;
	font-size: .92rem;
	color: var(--sg-body);
}
.page-numbers.current { background: var(--sg-navy); border-color: var(--sg-navy); color: #fff; }
.page-numbers:hover { border-color: var(--sg-cyan); }

/* -------------------------------------------------- footer ------------- */

.sg-footer {
	background: var(--sg-navy-deep);
	color: rgba(255,255,255,.7);
	padding: 48px 0 32px;
	font-size: .9rem;
	margin-top: 60px;
}
.sg-footer__inner {
	max-width: var(--sg-wide);
	margin-inline: auto;
	padding-inline: var(--sg-gutter);
}
.sg-footer a { color: #fff; text-decoration: none; }
.sg-footer a:hover { text-decoration: underline; }

.sg-footer__grid {
	display: grid;
	gap: 34px;
	grid-template-columns: 1fr;
	margin-bottom: 30px;
}
@media (min-width: 640px)  { .sg-footer__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .sg-footer__grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }

.sg-footer__logo {
	font-family: var(--sg-font-head);
	font-weight: 700;
	font-size: 1.1rem;
	color: #fff;
	display: inline-block;
	margin-bottom: 14px;
}
.sg-footer__logo img {
	display: block;
	width: auto;
	height: 44px;
	max-width: 100%;
}
.sg-footer__blurb { max-width: 34ch; margin-bottom: 1.2rem; }

.sg-footer__heading {
	font-family: var(--sg-font-head);
	font-size: .8rem;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: #fff;
	font-weight: 600;
	margin: 0 0 12px;
}

.sg-footer__list { list-style: none; margin: 0; padding: 0; }
.sg-footer__list li { margin-bottom: 7px; }

.sg-footer__bottom {
	border-top: 1px solid rgba(255,255,255,.14);
	padding-top: 20px;
	font-size: .82rem;
	opacity: .78;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 26px;
}
.sg-footer__bottom p { margin: 0; }

/* -------------------------------------------------- print -------------- */

@media print {
	.sg-header, .sg-footer, .sg-crumbs, .sg-btn, .sg-search { display: none !important; }
	body { font-size: 12pt; color: #000; }
	.sg-faq details { border: 0; }
	.sg-faq details > div { display: block !important; }
}


/* -------------------------------------------------- sections ----------- */
/* Alternating white / warm-grey bands with the live site's 56px→82px rhythm. */

.sg-section { padding: var(--sg-section-y) 0; }
.sg-section--warm {
	background: var(--sg-grey-warm);
	border-block: 1px solid var(--sg-navy-soft);
}
.sg-section--navy { background: var(--sg-navy-deep); color: rgba(255,255,255,.75); }
.sg-section--navy :is(h1,h2,h3,h4) { color: #fff; }

.has-brand-navy-color { color: var(--sg-navy) !important; }
.has-brand-navy-background-color { background-color: var(--sg-navy) !important; }
