/**
 * CliniEd — Base layer
 * Reset, document defaults, typography, layout primitives, utilities.
 * Consumes tokens.css only. No component styles here.
 */

/* ===========================================================================
 * 1. Reset
 * ======================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: var(--ce-header-offset, 100px);
}

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

/*
 * The design's ground is a flat lavender, top to bottom, with white reserved
 * for cards, the header and the hero wash. Set it on the body so every page —
 * home, blog, LearnDash — sits on the same ground.
 */
body {
	margin: 0;
	background-color: var(--ce-surface);
	color: var(--ce-text);
	font-family: var(--ce-font-body);
	font-size: var(--ce-fs-md);
	line-height: var(--ce-lh-normal);
	font-weight: var(--ce-fw-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-x: hidden;
}

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

input,
button,
textarea,
select { font: inherit; color: inherit; }

button { cursor: pointer; }

p,
h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* ===========================================================================
 * 2. Typography
 * ======================================================================== */
h1, h2, h3, h4, h5, h6,
.ce-h1, .ce-h2, .ce-h3, .ce-h4, .ce-h5, .ce-h6 {
	margin: 0 0 var(--ce-space-4);
	font-family: var(--ce-font-heading);
	color: var(--ce-heading);
	font-weight: var(--ce-fw-bold);
	line-height: var(--ce-lh-tight);
	letter-spacing: var(--ce-tracking-tight);
	text-wrap: balance;
}

h1, .ce-h1 { font-size: var(--ce-fs-4xl); font-weight: var(--ce-fw-bold); }
h2, .ce-h2 { font-size: var(--ce-fs-3xl); }
h3, .ce-h3 { font-size: var(--ce-fs-2xl); line-height: var(--ce-lh-snug); }
h4, .ce-h4 { font-size: var(--ce-fs-xl);  line-height: var(--ce-lh-snug); }
h5, .ce-h5 { font-size: var(--ce-fs-lg);  line-height: var(--ce-lh-snug); letter-spacing: var(--ce-tracking-tight); }
h6, .ce-h6 { font-size: var(--ce-fs-base);line-height: var(--ce-lh-snug); letter-spacing: var(--ce-tracking-tight); }

p { margin: 0 0 var(--ce-space-5); }
p:last-child { margin-bottom: 0; }

.ce-display {
	font-size: var(--ce-fs-4xl);
	font-weight: var(--ce-fw-bold);
	line-height: 1.04;
	letter-spacing: -0.03em;
}

.ce-lead {
	font-size: var(--ce-fs-lg);
	line-height: var(--ce-lh-relaxed);
	color: var(--ce-text-muted);
	text-wrap: pretty;
}

/*
 * A short accent rule, then the label in accent caps. The rule is drawn with
 * ::before so no extra element is needed in the markup.
 */
.ce-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: var(--ce-space-3);
	margin-top: 0;
	margin-bottom: var(--ce-space-4);
	font-family: var(--ce-font-heading);
	font-size: var(--ce-fs-xs);
	font-weight: var(--ce-fw-heading);
	letter-spacing: var(--ce-tracking-eyebrow);
	text-transform: uppercase;
	color: var(--ce-primary);
}

.ce-eyebrow::before {
	content: "";
	flex: none;
	width: 28px;
	height: 2px;
	background: currentColor;
}

/* Interior pages label the section without the hero's leading rule. */
.ce-eyebrow--plain::before { content: none; }

.ce-eyebrow--center { justify-content: center; }
.ce-eyebrow--invert { color: var(--ce-accent); }

a {
	color: var(--ce-primary);
	text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
	text-underline-offset: 0.18em;
	transition: color var(--ce-dur-fast) var(--ce-ease);
}
a:hover { color: var(--ce-primary-hover); }

small { font-size: var(--ce-fs-sm); }

blockquote {
	margin: var(--ce-space-8) 0;
	padding: var(--ce-space-6) var(--ce-space-8);
	border-left: 4px solid var(--ce-accent);
	border-radius: 0 var(--ce-radius-md) var(--ce-radius-md) 0;
	background: var(--ce-surface-alt);
	font-size: var(--ce-fs-lg);
	font-style: italic;
	color: var(--ce-text);
}

code, kbd, samp, pre { font-family: var(--ce-font-mono); font-size: 0.9em; }

code {
	padding: 0.15em 0.42em;
	border-radius: var(--ce-radius-sm);
	background: var(--ce-surface-sunken);
	color: var(--ce-ink);
}

hr {
	height: 1px;
	margin: var(--ce-space-12) 0;
	border: 0;
	background: var(--ce-border);
}

/* ===========================================================================
 * 3. Accessibility helpers
 * ======================================================================== */
.screen-reader-text,
.ce-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ce-skip-link {
	position: absolute;
	top: -100px;
	left: var(--ce-space-4);
	z-index: var(--ce-z-modal);
	padding: var(--ce-space-3) var(--ce-space-5);
	border-radius: 0 0 var(--ce-radius-sm) var(--ce-radius-sm);
	background: var(--ce-primary);
	color: var(--ce-primary-contrast);
	font-weight: var(--ce-fw-heading);
	text-decoration: none;
	transition: top var(--ce-dur) var(--ce-ease);
}
.ce-skip-link:focus { top: 0; color: var(--ce-primary-contrast); }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--ce-primary);
	outline-offset: 2px;
	border-radius: var(--ce-radius-sm);
}

/* ===========================================================================
 * 4. Layout primitives
 * ======================================================================== */
.ce-container {
	width: 100%;
	max-width: calc(var(--ce-container) + (var(--ce-gutter) * 2));
	margin-inline: auto;
	padding-inline: var(--ce-gutter);
}
.ce-container--wide   { max-width: calc(var(--ce-container-wide) + (var(--ce-gutter) * 2)); }
.ce-container--narrow { max-width: calc(var(--ce-container-narrow) + (var(--ce-gutter) * 2)); }

.ce-section { padding-block: var(--ce-section-y); }
.ce-section--lg { padding-block: var(--ce-section-y-lg); }
.ce-section--tight { padding-block: clamp(2.25rem, 4vw, 3.5rem); }
.ce-section--flush-top { padding-top: 0; }
.ce-section--flush-bottom { padding-bottom: 0; }

/*
 * Sections are divided by a hairline, not by alternating tints — they all sit
 * on the same lavender ground.
 */
.ce-section--rule { border-top: 1px solid var(--ce-divider); }

.ce-section--alt    { background: var(--ce-surface-alt); }
.ce-section--sunken { background: var(--ce-surface-sunken); }
.ce-section--soft   { background: var(--ce-bg); }
.ce-section--invert {
	background: var(--ce-indigo);
	color: rgba(255, 255, 255, 0.82);
}
.ce-section--invert :is(h1, h2, h3, h4, h5, h6) { color: var(--ce-white); }
.ce-section--invert .ce-lead { color: rgba(255, 255, 255, 0.74); }

/* Section heading block */
.ce-section-head {
	max-width: 720px;
	margin-bottom: clamp(2.25rem, 4vw, 3.5rem);
}
.ce-section-head--center {
	margin-inline: auto;
	text-align: center;
}
.ce-section-head--narrow { max-width: 620px; }

/* Heading on the left, a single action on the right. */
.ce-section-head--split {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--ce-space-6);
	max-width: none;
}
.ce-section-head--split > div { max-width: 620px; }
@media (max-width: 720px) {
	.ce-section-head--split { flex-direction: column; align-items: flex-start; }
}

/* The line that sits under a section heading, not above it. */
.ce-section-head__sub {
	margin: var(--ce-space-2) 0 0;
	font-size: var(--ce-fs-md);
	color: var(--ce-muted);
}

.ce-section-head > :last-child { margin-bottom: 0; }

/* Grid */
.ce-grid { display: grid; gap: var(--ce-space-6); }
.ce-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ce-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ce-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ce-grid--gap-lg { gap: var(--ce-space-8); }

/* Auto-fit grid: never drops below the given min width */
.ce-grid--auto {
	grid-template-columns: repeat(auto-fit, minmax(min(var(--ce-grid-min, 280px), 100%), 1fr));
}

@media (max-width: 1024px) {
	.ce-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ce-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
	.ce-grid--2,
	.ce-grid--3,
	.ce-grid--4 { grid-template-columns: minmax(0, 1fr); }
}

/* Split (content + media) */
.ce-split {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(2rem, 5vw, 4.5rem);
	align-items: center;
}
.ce-split--media-first > .ce-split__media { order: -1; }
.ce-split--top { align-items: start; }
@media (max-width: 900px) {
	.ce-split { grid-template-columns: minmax(0, 1fr); }
	.ce-split--media-first > .ce-split__media { order: 0; }
}

/* Flex helpers */
.ce-cluster {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ce-space-3);
}
.ce-cluster--center { justify-content: center; }
.ce-cluster--between { justify-content: space-between; }
.ce-cluster--gap-lg { gap: var(--ce-space-5); }

.ce-stack { display: flex; flex-direction: column; gap: var(--ce-space-4); }
.ce-stack--gap-lg { gap: var(--ce-space-6); }

/* ===========================================================================
 * 5. Utilities
 * ======================================================================== */
.ce-text-center { text-align: center; }
.ce-text-left   { text-align: left; }
.ce-text-muted  { color: var(--ce-text-muted); }
.ce-text-accent { color: var(--ce-accent); }
.ce-text-primary{ color: var(--ce-primary); }

.ce-mb-0 { margin-bottom: 0 !important; }
.ce-mb-2 { margin-bottom: var(--ce-space-2); }
.ce-mb-4 { margin-bottom: var(--ce-space-4); }
.ce-mb-6 { margin-bottom: var(--ce-space-6); }
.ce-mb-8 { margin-bottom: var(--ce-space-8); }
.ce-mt-8 { margin-top: var(--ce-space-8); }
.ce-mt-12{ margin-top: var(--ce-space-12); }

.ce-mx-auto { margin-inline: auto; }
.ce-measure { max-width: 62ch; }
.ce-full-width { width: 100%; }

/* Gradient text — used sparingly on hero keywords */
.ce-gradient-text {
	background: linear-gradient(100deg, var(--ce-accent) 0%, var(--ce-accent) 90%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

/* Decorative background flourishes */
.ce-glow {
	position: absolute;
	border-radius: 50%;
	filter: blur(90px);
	opacity: 0.5;
	pointer-events: none;
	z-index: 0;
}

.ce-relative { position: relative; z-index: 1; }

/* Scroll-reveal — progressively enhanced by app.js */
.ce-reveal {
	opacity: 0;
	transform: translateY(22px);
	transition:
		opacity var(--ce-dur-slow) var(--ce-ease-out),
		transform var(--ce-dur-slow) var(--ce-ease-out);
}
.ce-reveal.is-visible { opacity: 1; transform: none; }

/* If JS never runs, content must still be visible */
.no-js .ce-reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
	.ce-reveal { opacity: 1; transform: none; }
}

/* Print */
@media print {
	.ce-header, .ce-footer, .ce-cta-band, .ce-skip-link { display: none !important; }
	body { color: #000; background: #fff; }
}

/* ===========================================================================
 * Long-token safety
 * ---------------------------------------------------------------------------
 * Emails, URLs and other unbreakable strings must wrap rather than force the
 * page to scroll sideways.
 * ======================================================================== */
.ce-footer__list a,
.ce-breadcrumb,
.ce-prose a { overflow-wrap: break-word; }
