/*
 * SurgCase — single case view styles (single-sc_case.php).
 * Ported from the design's inline styles (design/medical-qa-library.dc.html, isCase branch).
 * Every selector is namespaced under .sc-case-* so it cannot collide with archive.css/pages.css.
 */

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

.sc-case-main {
	max-width: 1180px;
	margin: 0 auto;
	padding: 28px 24px 90px;
	display: grid;
	grid-template-columns: 1fr 232px;
	gap: 52px;
	align-items: start;
}

.sc-case-article {
	min-width: 0;
}

/* ------------------------------------------------------------ breadcrumb */

.sc-case-crumb {
	font-size: 12.5px;
	color: var(--sc-mut2, #8d8f8a);
	margin-bottom: 14px;
}

.sc-case-crumb-sep {
	color: var(--sc-mut2, #8d8f8a);
}

/* ----------------------------------------------------------- title, tags */

.sc-case-title {
	margin: 0 0 10px;
	color: var(--sc-text, #1f2220);
	font-size: 29px;
	font-weight: 600;
	letter-spacing: -0.025em;
	line-height: 1.25;
}

.sc-case-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 22px;
}

.sc-case-tag {
	display: inline-flex;
	align-items: center;
	font-size: 11.5px;
	color: var(--sc-tag-text, oklch(0.44 0.13 45));
	background: var(--sc-tag-bg, oklch(0.965 0.022 60));
	border: 1px solid var(--sc-tag-line, oklch(0.90 0.045 55));
	border-radius: 3px;
	padding: 2px 7px;
	text-decoration: none;
}

a.sc-case-tag:hover,
a.sc-case-tag:focus-visible {
	color: var(--sc-tag-text, oklch(0.44 0.13 45));
	background: #fff4e5;
	text-decoration: none;
}

/* ------------------------------------------------------- section labels */

.sc-case-eyebrow {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--sc-mut2, #8d8f8a);
	margin-bottom: 7px;
}

.sc-case-h2 {
	margin: 0 0 14px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--sc-mut2, #8d8f8a);
}

/* --------------------------------------------------- clinical description */

.sc-case-desc {
	border-inline-start: 2px solid var(--sc-link, oklch(0.50 0.13 253));
	padding-inline-start: 16px;
	margin-bottom: 28px;
}

.sc-case-desc p {
	margin: 0;
	font-size: 16px;
	line-height: 1.7;
	color: var(--sc-body, #33362f);
	max-width: 70ch;
	text-wrap: pretty;
}

/* ------------------------------------------------------------- image grid */

.sc-case-figures {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
	margin-bottom: 34px;
	align-items: start;
}

.sc-case-fig {
	margin: 0;
}

.sc-case-figbox {
	aspect-ratio: 16 / 10;
	border: 1px solid var(--sc-line, #e5e4e0);
	border-radius: 4px;
	background-color: #f4f3f0;
	background-image: repeating-linear-gradient(135deg, #eceae5 0 8px, #f4f3f0 8px 16px);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

button.sc-case-lightbox-trigger {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: inherit;
	background: transparent;
	cursor: zoom-in;
}

.sc-case-lightbox-trigger img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: inherit;
	transition: transform 180ms ease;
}

.sc-case-lightbox-trigger:hover img,
.sc-case-lightbox-trigger:focus-visible img {
	transform: scale(1.015);
}

.sc-case-lightbox-icon {
	position: absolute;
	inset-inline-end: 10px;
	inset-block-end: 10px;
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border: 1px solid rgb(255 255 255 / 65%);
	border-radius: 50%;
	background: rgb(25 28 26 / 76%);
	box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
	color: #fff;
	font-size: 20px;
	font-weight: 300;
	line-height: 1;
	pointer-events: none;
}

.sc-case-slot {
	font-size: 11.5px;
	color: var(--sc-mut, #5f625d);
	background: var(--sc-bg, #fbfbfa);
	border: 1px solid var(--sc-line, #e5e4e0);
	padding: 4px 9px;
	border-radius: 3px;
}

.sc-case-cap {
	margin-top: 7px;
	font-size: 12.5px;
	color: var(--sc-mut, #6f716d);
	line-height: 1.5;
}

/* -------------------------------------------------------------- lightbox */

body.sc-lightbox-open {
	overflow: hidden;
}

.sc-lightbox {
	width: min(1180px, calc(100vw - 32px));
	max-width: none;
	max-height: none;
	margin: auto;
	padding: 0;
	border: 0;
	background: transparent;
	color: #fff;
	overflow: visible;
}

.sc-lightbox::backdrop {
	background: rgb(15 18 16 / 90%);
	backdrop-filter: blur(3px);
}

.sc-lightbox__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: min(82vh, 820px);
	padding: 56px 64px 26px;
	border-radius: 6px;
	background: #171a18;
	box-shadow: 0 24px 72px rgb(0 0 0 / 45%);
}

.sc-lightbox__figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 0;
	margin: 0;
}

.sc-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: calc(82vh - 140px);
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 8px 32px rgb(0 0 0 / 28%);
}

.sc-lightbox__caption {
	max-width: 80ch;
	margin-top: 14px;
	color: rgb(255 255 255 / 82%);
	font-size: 13px;
	line-height: 1.55;
	text-align: center;
}

.sc-lightbox__caption:empty {
	display: none;
}

.sc-lightbox__counter {
	margin-top: 7px;
	color: rgb(255 255 255 / 56%);
	font-size: 11.5px;
}

button.sc-lightbox__close,
button.sc-lightbox__nav {
	position: absolute;
	z-index: 1;
	display: grid;
	place-items: center;
	margin: 0;
	padding: 0;
	border: 1px solid rgb(255 255 255 / 22%);
	border-radius: 50%;
	background: rgb(255 255 255 / 9%);
	color: #fff;
	cursor: pointer;
	direction: ltr;
}

.sc-lightbox__close:hover,
.sc-lightbox__close:focus-visible,
.sc-lightbox__nav:hover,
.sc-lightbox__nav:focus-visible {
	background: rgb(255 255 255 / 17%);
	border-color: rgb(255 255 255 / 45%);
}

.sc-lightbox__close {
	top: 12px;
	right: 12px;
	width: 38px;
	height: 38px;
	font-size: 25px;
	font-weight: 300;
	line-height: 1;
}

.sc-lightbox__nav {
	top: 50%;
	width: 42px;
	height: 42px;
	font-size: 28px;
	line-height: 1;
	transform: translateY(-50%);
}

.sc-lightbox__nav--previous {
	left: 11px;
}

.sc-lightbox__nav--next {
	right: 11px;
}

.sc-lightbox__nav[hidden] {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.sc-case-lightbox-trigger img {
		transition: none;
	}
}

/* ------------------------------------------------------ questions/answers */

.sc-case-qa-head {
	margin: 0 0 4px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--sc-mut2, #8d8f8a);
	border-bottom: 1px solid var(--sc-line, #e5e4e0);
	padding-bottom: 10px;
}

.sc-case-qa {
	padding: 26px 0;
	border-bottom: 1px solid var(--sc-line2, #ebeae6);
	scroll-margin-top: var(--sc-anchor-offset, 72px);
}

.sc-case-qa:last-of-type {
	border-bottom: 0;
}

.sc-case-q {
	margin: 0 0 12px;
	color: var(--sc-text, #1f2220);
	font-size: 18px;
	font-weight: 600;
	letter-spacing: -0.015em;
	line-height: 1.45;
	display: flex;
	gap: 12px;
}

.sc-case-qn {
	font-size: 14px;
	color: #356fa9;
	font-weight: 500;
	padding-top: 2px;
	flex: none;
}

.sc-case-a {
	padding-inline-start: 26px;
}

.sc-case-a p {
	margin: 0;
	font-size: 15.5px;
	line-height: 1.75;
	color: var(--sc-body, #33362f);
	max-width: 72ch;
	text-wrap: pretty;
	white-space: pre-line;
}

/* -------------------------------------------------- references and files */

.sc-case-appendix {
	margin-top: 44px;
	padding-top: 22px;
	border-top: 2px solid var(--sc-line, #e5e4e0);
}

.sc-case-refs {
	margin: 0 0 26px;
	padding-inline-start: 20px;
	color: #5c5f5b;
	font-size: 13.5px;
	line-height: 1.9;
}

.sc-case-files-head {
	margin: 0 0 12px;
}

.sc-case-files {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sc-case-file {
	display: flex;
	align-items: center;
	gap: 10px;
	border: 1px solid var(--sc-line, #e5e4e0);
	background: #fff;
	border-radius: 4px;
	padding: 10px 13px;
	font-size: 13.5px;
	max-width: 440px;
	color: inherit;
	text-decoration: none;
}

a.sc-case-file:hover,
a.sc-case-file:focus-visible {
	border-color: var(--sc-link, oklch(0.50 0.13 253));
	text-decoration: none;
}

.sc-case-file-ext {
	font-size: 10.5px;
	color: var(--sc-mut2, #8d8f8a);
	border: 1px solid var(--sc-line, #e5e4e0);
	border-radius: 2px;
	padding: 2px 5px;
	flex: none;
}

.sc-case-file-name {
	flex: 1;
	color: var(--sc-body, #33362f);
}

.sc-case-file-size {
	font-size: 11.5px;
	color: var(--sc-mut3, #a3a5a0);
	flex: none;
}

/* ----------------------------------------------------------- related cases */

.sc-case-related {
	margin-top: 36px;
	padding-top: 22px;
	border-top: 1px solid var(--sc-line, #e5e4e0);
}

.sc-case-related-head {
	margin: 0 0 4px;
}

.sc-case-related-row {
	padding: 14px 0;
	border-bottom: 1px solid var(--sc-line2, #ebeae6);
}

.sc-case-related-link {
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
	display: block;
	margin-bottom: 3px;
}

.sc-case-related-meta {
	font-size: 12px;
	color: var(--sc-mut2, #8d8f8a);
}

/* -------------------------------------------------------------------- TOC */

.sc-case-toc {
	position: sticky;
	top: var(--sc-sticky-top, 88px);
}

.sc-case-toc-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--sc-mut2, #8d8f8a);
	margin-bottom: 11px;
}

.sc-case-toc-nav {
	display: flex;
	flex-direction: column;
	gap: 9px;
	border-inline-start: 1px solid var(--sc-line, #e5e4e0);
	padding-inline-start: 13px;
}

.sc-case-toc-link {
	font-size: 13px;
	line-height: 1.5;
	color: #5c5f5b;
}

.sc-case-toc-meta {
	margin-top: 22px;
	border-top: 1px solid var(--sc-line, #e5e4e0);
	padding-top: 16px;
	font-size: 12.5px;
	color: var(--sc-mut2, #8d8f8a);
	line-height: 1.7;
}

.sc-case-print {
	display: inline-block;
	margin-top: 16px;
	font-size: 12.5px;
	font-family: inherit;
	border: 0;
	background: transparent;
	color: var(--sc-link);
	padding: 0;
	cursor: pointer;
}

.sc-case-print:hover,
.sc-case-print:focus-visible {
	color: var(--sc-link-hover);
	text-decoration: underline;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 900px) {
	.sc-case-main {
		grid-template-columns: 1fr;
		gap: 18px;
	}

	.sc-case-toc {
		display: none;
	}
}

@media (max-width: 560px) {
	.sc-case-main {
		padding: 20px 18px 64px;
	}

	.sc-case-title {
		font-size: 25px;
	}

	.sc-case-figures {
		grid-template-columns: 1fr;
	}

	.sc-lightbox {
		width: calc(100vw - 16px);
	}

	.sc-lightbox__stage {
		min-height: 76vh;
		padding: 54px 12px 68px;
	}

	.sc-lightbox__image {
		max-height: calc(76vh - 176px);
	}

	.sc-lightbox__nav {
		top: auto;
		bottom: 12px;
		transform: none;
	}

	.sc-case-q {
		font-size: 17px;
		gap: 9px;
	}

	.sc-case-a {
		padding-inline-start: 22px;
	}

	.sc-case-file {
		align-items: flex-start;
		flex-wrap: wrap;
	}
}

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

@media print {
	.sc-case-main {
		display: block;
		max-width: none;
		padding: 0;
		gap: 0;
	}

	.sc-case-toc,
	.sc-case-crumb,
	.sc-lightbox {
		display: none !important;
	}

	.sc-case-article {
		min-width: 0;
	}

	.sc-case-title {
		font-size: 22px;
	}

	.sc-case-qa,
	.sc-case-fig,
	.sc-case-file,
	.sc-case-related-row {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	.sc-case-figbox {
		background-image: none;
		height: 120px;
	}

	.sc-case-desc p,
	.sc-case-a p {
		max-width: none;
	}

	.sc-case-related-link,
	.sc-case-crumb a {
		color: var(--sc-text, #1f2220) !important;
		text-decoration: none !important;
	}
}
