/* Case Study front-end styling */

:root {
	/* Brand colors — aliased to Astra's global color palette so this tracks
	   Customizer changes instead of hardcoding hex. */
	--cs-color-cyan:   var(--ast-global-color-1);
	--cs-color-yellow: var(--ast-global-color-0);
	--cs-color-green:  var(--ast-global-color-2);
	--cs-text:         var(--ast-global-color-3);
	--cs-bg-card:      var(--ast-global-color-5);

	/* Previously-unconfirmed values, now resolved. */
	--cs-bg-page:    #f5f5f5;
	--cs-border:     color-mix(in srgb, var(--cs-text) 12%, transparent);
	--cs-text-muted: color-mix(in srgb, var(--cs-text) 70%, transparent);

	/* Typography */
	--cs-font-body:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	--cs-font-heading: Roboto, sans-serif;

	--cs-text-size: 15px;
	--cs-text-line: 24.75px;

	--cs-h1-size: 40px; --cs-h1-line: 56px;
	--cs-h2-size: 32px; --cs-h2-line: 41.6px;
	--cs-h3-size: 26px; --cs-h3-line: 33.8px;
	--cs-heading-weight: 600;
	--cs-letter-spacing: normal;

	/* Layout & spacing */
	--cs-container-max:    1240px;
	--cs-container-gutter: 20px;
	--cs-section-space:    3em;

	/* Component: primary CTA button treatment, for reuse on accented/interactive elements */
	--cs-radius:              50px;
	--cs-btn-bg:              var(--ast-global-color-1);
	--cs-btn-bg-hover:        var(--ast-global-color-0);
	--cs-btn-text:            var(--ast-global-color-3);
	--cs-btn-border-width:    2px;
	--cs-btn-border-color:    var(--ast-global-color-3);
	--cs-btn-padding:         15px 30px;
	--cs-btn-hover-transform: scale(0.9);
}

.cs-hero {
	/* One of the page's two visual peaks (the other is the feature quote) —
	   given more breathing room than a standard section gap. */
	margin-bottom: calc(var(--cs-section-space) * 1.4);
}

.cs-hero-band {
	position: relative;
	height: 260px;
	flex-shrink: 0;
	min-height: 0;
	overflow: hidden;
	border-radius: 8px;
	margin-bottom: 1em;
}

.cs-hero-scrim {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 2.5em 1.5em 1.2em;
}

.cs-hero-eyebrow-pill {
	display: inline-block;
	margin-bottom: 0.6em;
	padding: 0.35em 0.9em;
	border-radius: var(--cs-radius);
	border: var(--cs-btn-border-width) solid var(--cs-text);
	background: var(--cs-bg-card);
	color: var(--cs-text);
	font-family: var(--cs-font-heading);
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.cs-hero-title {
	margin: 0;
}

.cs-hero-subtitle {
	font-size: 1.2em;
	color: var(--cs-text-muted);
}

.cs-section {
	margin-bottom: var(--cs-section-space);
}

.cs-section h2 {
	display: inline-block;
	margin-bottom: 0.8em;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--cs-color-cyan);
	font-family: var(--cs-font-heading);
	font-weight: var(--cs-heading-weight);
	font-size: var(--cs-h2-size);
	line-height: var(--cs-h2-line);
}

.cs-client-panel {
	background: var(--cs-bg-page);
	border-radius: 12px;
	padding: 2em;
}

.cs-client-panel .cs-rich-text:last-child,
.cs-client-panel .cs-facts-grid:last-child {
	margin-bottom: 0;
}

.cs-rich-text {
	margin-bottom: 1em;
}

.cs-list {
	padding-left: 1.2em;
	margin-bottom: 1em;
}

.cs-list li {
	margin-bottom: 0.4em;
}

.cs-facts-grid,
.cs-metrics-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1.2em;
	margin: 1.5em 0;
}

.cs-fact,
.cs-metric {
	text-align: center;
	padding: 1.75em 1.25em;
	background: var(--cs-bg-card);
	border-top: 8px solid var(--cs-color-cyan);
	border-radius: 8px;
	/* Keyline, not a shadow: defines the top edge where the yellow bar
	   meets the white card, since pure yellow has no natural contrast line. */
	box-shadow: inset 0 1px 0 var(--cs-border);
}

.cs-fact:nth-child(even),
.cs-metric:nth-child(even) {
	border-top-color: var(--cs-color-yellow);
}

.cs-fact-stat,
.cs-metric-figure {
	display: block;
	font-family: var(--cs-font-heading);
	font-size: 1.6em;
	font-weight: 700;
	margin-bottom: 0.2em;
}

.cs-fact-description,
.cs-metric-label {
	display: block;
	font-size: 0.9em;
	color: var(--cs-text-muted);
}

.cs-timeline {
	position: relative;
	margin-top: 1.75em;
	padding-left: 2.5em;
}

.cs-timeline::before {
	content: '';
	position: absolute;
	left: calc(1.25em - 1.5px);
	top: 4px;
	bottom: 4px;
	width: 3px;
	border-radius: 2px;
	background: linear-gradient(to bottom, var(--cs-color-cyan), var(--cs-color-yellow));
}

.cs-timeline-item {
	position: relative;
	padding-bottom: 2em;
}

.cs-timeline-item:last-child {
	padding-bottom: 0;
}

.cs-timeline-node {
	position: absolute;
	left: -1.875em;
	top: 0.2em;
	width: 1.25em;
	height: 1.25em;
	border-radius: 50%;
	/* Rings the node in the page background so it reads as sitting on top
	   of the spine rather than the spine passing through it. */
	box-shadow: 0 0 0 4px var(--cs-bg-card);
}

.cs-timeline-node--0 {
	background: var(--cs-color-cyan);
}

.cs-timeline-node--1 {
	background: var(--cs-color-green);
}

.cs-timeline-node--2 {
	background: var(--cs-color-yellow);
}

.cs-phase-name {
	margin-bottom: 0.4em;
}

.cs-phase-duration {
	display: inline-block;
	margin-left: 0.5em;
	font-size: 0.7em;
	font-weight: 400;
	color: var(--cs-text-muted);
}

.cs-engagement-title {
	margin-bottom: 0.6em;
}

/* Mosaic: first image large on the left, the rest stacked on the right.
   Degrades reasonably with 1-2 images since grid-auto-flow just leaves the
   second column short rather than breaking. */
.cs-gallery {
	display: grid;
	grid-template-columns: 2fr 1fr;
	grid-auto-rows: 160px;
	gap: 1em;
	margin-top: 1.5em;
}

.cs-gallery-figure {
	margin: 0;
}

.cs-gallery-figure:first-child {
	grid-row: span 2;
}

.cs-gallery-figure img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 8px;
}

.cs-gallery-figure figcaption {
	font-size: 0.85em;
	opacity: 0.7;
	margin-top: 0.4em;
}

.cs-section-testimonials {
	/* The other visual peak (alongside the hero) — extra room above and
	   below so the dark quote reads as a deliberate pause, not a section
	   like any other. */
	margin-top: calc(var(--cs-section-space) * 0.5);
	margin-bottom: calc(var(--cs-section-space) * 1.4);
}

.cs-testimonials {
	display: flex;
	flex-direction: column;
	gap: 1.5em;
}

.cs-testimonial {
	margin: 0;
	padding: 1.75em 2em;
	background: var(--cs-bg-page);
	border-left: 5px solid var(--cs-color-cyan);
	border-radius: 0;
}

.cs-testimonial-quote {
	font-family: var(--cs-font-heading);
	font-size: 1.35em;
	font-weight: 500;
	font-style: normal;
	margin-bottom: 0.8em;
}

.cs-testimonial-attribution {
	font-style: normal;
	font-size: 0.85em;
	color: var(--cs-text-muted);
}

/* Feature quote — the first testimonial, on a dark (never pure black)
   branded ground, the page's second visual peak alongside the hero. */
.cs-testimonial--feature {
	position: relative;
	overflow: hidden;
	background: var(--cs-text);
	border-left: none;
	padding: 2.5em;
}

.cs-testimonial--feature .cs-testimonial-quote {
	position: relative;
	z-index: 1;
	color: var(--cs-bg-card);
	font-size: 1.5em;
}

.cs-testimonial--feature .cs-testimonial-attribution {
	position: relative;
	z-index: 1;
	color: var(--cs-color-cyan);
}

.cs-testimonial-motif {
	position: absolute;
	right: -40px;
	bottom: -40px;
	width: 160px;
	height: 160px;
	background-image:
		radial-gradient(circle at 35% 65%, var(--cs-color-cyan) 0 45%, transparent 46%),
		radial-gradient(circle at 65% 35%, var(--cs-color-yellow) 0 38%, transparent 39%);
	opacity: 0.9;
}

.cs-skills {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em;
	margin-top: 1.5em;
}

.cs-skills-label {
	font-family: var(--cs-font-heading);
	font-weight: var(--cs-heading-weight);
	font-size: 0.85em;
	margin-right: 0.3em;
}

.cs-skill-tag {
	font-size: 0.8em;
	padding: 0.3em 0.8em;
	border-radius: var(--cs-radius);
	background: var(--cs-bg-page);
	color: var(--cs-text-muted);
}

/* Archive-only override, scoped with the post-type-archive-case_study body
   class since this stylesheet also loads on the single template.
   post-type-archive-case_study and ast-separate-container are BOTH classes
   on <body> itself (not nested), so this must be one compound selector
   (no space between them) rather than a descendant combinator. */
.post-type-archive-case_study.ast-separate-container .ast-article-post,
.post-type-archive-case_study.ast-separate-container .ast-article-single,
.post-type-archive-case_study.ast-separate-container .ast-author-box,
.post-type-archive-case_study.ast-separate-container .ast-404-layout-1,
.post-type-archive-case_study.ast-separate-container .no-results {
	padding: 0;
	padding-bottom: 3rem;
	border-radius: 12px;
}

/* Archive page title only — on the single template #primary's header sits
   inside an <article>, so this direct-child chain doesn't match there. */
#primary > header > h1 {
	font-size: 4rem;
	font-weight: 600;
	line-height: 1.4em;
	text-decoration: underline;
}

/* Archive — filter pills */

.cs-archive-header {
	margin-bottom: 2em;
}

.cs-filter-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
	margin-bottom: 2em;
}

.cs-filter-pill {
	font-family: var(--cs-font-heading);
	font-size: 0.9em;
	padding: 0.5em 1.2em;
	border-radius: var(--cs-radius);
	border: var(--cs-btn-border-width) solid var(--cs-border);
	background: var(--cs-bg-card);
	color: var(--cs-text);
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cs-filter-pill:hover {
	border-color: var(--cs-text-muted);
}

.cs-filter-pill.is-active {
	background: var(--cs-btn-bg);
	border-color: var(--cs-btn-border-color);
	color: var(--cs-btn-text);
}

/* Archive — 2-up card grid */

.cs-archive-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 2em;
	margin-bottom: 2em;
}

@media (max-width: 640px) {
	.cs-archive-grid {
		grid-template-columns: 1fr;
	}
}

.cs-card.is-hidden {
	display: none;
}

.cs-card-link {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: inherit;
	text-decoration: none;
	background: var(--cs-bg-card);
	border-radius: 8px;
	overflow: hidden;
	box-shadow: inset 0 1px 0 var(--cs-border);
}

.cs-card-strip {
	display: block;
	height: 6px;
	flex-shrink: 0;
	background: var(--cs-color-cyan);
}

.cs-card:nth-child(even) .cs-card-strip {
	background: var(--cs-color-yellow);
}

/* Card header band — real featured image, or a deterministic branded
   fallback (never random: same post always renders the same variant). */
.cs-card-header {
	position: relative;
	height: 150px;
	flex-shrink: 0;
	/* Flex items default to min-height: auto, which lets an oversized
	   image's intrinsic size win over the explicit height above even with
	   overflow: hidden here. min-height: 0 opts back into the fixed size. */
	min-height: 0;
	overflow: hidden;
}

.cs-card-header img,
.cs-hero-band img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Deterministic branded fallback backgrounds — shared by the archive card
   header band and the single-page hero band (see cs_media_fallback_class()).
   Container-agnostic on purpose: whichever element needs a fallback fill
   just adds one of these classes, no duplicated declarations. Actual brand
   imagery, not invented gradients — swap the URLs here if EIC replaces them. */
.cs-fallback-media--0,
.cs-fallback-media--1,
.cs-fallback-media--2,
.cs-fallback-media--3 {
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

/* Single case study only — not the archive cards, which share these same
   fallback classes on .cs-card-header. */
.cs-hero-band.cs-fallback-media--0,
.cs-hero-band.cs-fallback-media--1,
.cs-hero-band.cs-fallback-media--2,
.cs-hero-band.cs-fallback-media--3 {
	border: double 10px;
}

.cs-fallback-media--0 {
	background-image: url('/wp-content/uploads/2022/12/1-3.png');
}

.cs-fallback-media--1 {
	background-image: url('/wp-content/uploads/2022/12/4-1.png');
}

.cs-fallback-media--2 {
	background-image: url('/wp-content/uploads/2022/12/3.png');
}

.cs-fallback-media--3 {
	background-image: url('/wp-content/uploads/2022/12/2-1.png');
}

.cs-card-header-pill {
	position: absolute;
	left: 0.8em;
	bottom: 0.8em;
	padding: 0.35em 0.9em;
	border-radius: var(--cs-radius);
	/* Ink background + white text: the real fallback photos are busier than
	   the old gradients, so the pill needs solid contrast rather than a
	   translucent light chip. */
	background: var(--cs-text);
	color: var(--cs-bg-card);
	font-family: var(--cs-font-heading);
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.cs-card-body {
	padding: 1.5em 1.5em 1em;
	flex: 1 0 auto;
}

.cs-card-meta {
	font-family: var(--cs-font-heading);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: 0.8em;
	color: var(--cs-text-muted);
	margin-bottom: 0.4em;
}

.cs-card-title {
	font-family: var(--cs-font-heading);
	font-weight: var(--cs-heading-weight);
	margin-bottom: 0.4em;
}

.cs-card-subtitle {
	color: var(--cs-text-muted);
}

.cs-card-stat {
	margin-top: auto;
	padding: 1em 1.5em 1.5em;
	border-top: 1px solid var(--cs-border);
}

.cs-card-stat-figure {
	display: block;
	font-family: var(--cs-font-heading);
	font-size: 1.5em;
	font-weight: 700;
}

.cs-card-stat-label {
	display: block;
	font-size: 0.85em;
	color: var(--cs-text-muted);
}

/* Client-facts fallback row, shown only when a study has no key metrics. */
.cs-card-stat--facts {
	display: flex;
	gap: 1em;
}

.cs-card-fact {
	flex: 1;
	min-width: 0;
}

.cs-card-fact-stat {
	display: block;
	font-family: var(--cs-font-heading);
	font-size: 1.1em;
	font-weight: 700;
}

.cs-card-fact-label {
	display: block;
	font-size: 0.75em;
	color: var(--cs-text-muted);
}

/* Preserve paragraph breaks stored as line breaks in case study text fields. */
.cs-summary,
.cs-rich-text,
.cs-phase-detail {
	white-space: pre-line;
}
