/**
 * Case Results table -- [case_results_table].
 *
 * Values are taken from Sky's design. The design expressed everything as inline styles;
 * they live here instead so the markup stays readable and the breakpoints can do their job.
 *
 * Every rule is scoped under .cw-cr twice (.cw-cr .cw-cr__x) so the component beats the
 * theme's global table, link and heading selectors, which are two classes deep and would
 * otherwise win on specificity.
 *
 * The font stacks are the design's own variables, which already name this theme's fonts
 * (Gilroy, Addington CF, DIN Pro -- all present in the theme's fonts/ directory). They are
 * scoped to .cw-cr rather than :root so nothing leaks into the rest of the page.
 */

.cw-cr {
	/*
	 * Set per instance by the shortcode's styling attributes, which write them inline on
	 * this wrapper. Declared here so the table has sane defaults when nothing is passed,
	 * and so there is one place to look for what is configurable.
	 *
	 * An inline value beats everything below, including the responsive overrides -- a
	 * padding chosen on the page applies at every screen size, by design.
	 */
	--cw-cr-cell-pad: 12px;
	--cw-cr-margin: 0;
	--cw-cr-max-width: none;
	--cw-cr-min-width: 1600px;

	--cw-cr-font-main: "Gilroy", "Poppins", system-ui, sans-serif;
	--cw-cr-font-serif: "Addington CF", "Source Serif 4", Georgia, serif;
	--cw-cr-font-din: "DIN Pro", "Gilroy", "Poppins", system-ui, sans-serif;
	--cw-cr-ink: #04082a;
	--cw-cr-ink-muted: #383838;
	--cw-cr-navy: #071025;
	--cw-cr-gold: #dcb458;
	--cw-cr-bronze: #88541b;
	--cw-cr-link: #996a3d;
	--cw-cr-zebra: #f7f7f7;

	box-sizing: border-box;

	margin: var( --cw-cr-margin, 0 );
	max-width: var( --cw-cr-max-width, none );
}

.cw-cr *,
.cw-cr *::before,
.cw-cr *::after {
	box-sizing: inherit;
}

/* ---------------------------------------------------------------- heading */

.cw-cr .cw-cr__intro {
	max-width: 1035px;
	margin-bottom: 56px;
}

.cw-cr .cw-cr__title {
	margin: 0;
	font-family: var(--cw-cr-font-din);
	font-size: 40px;
	line-height: 48px;
	font-weight: 700;
	color: #020624;
	text-wrap: pretty;
}

/* ------------------------------------------------------------ table frame */

.cw-cr .cw-cr__frame {
	background: #fff;
	border: 1px solid #000;
}

/*
 * The table names itself with a real <caption>, which is what a parser reads as the
 * table's title. It is taken out of flow rather than given a 1px box: a *sized* caption
 * makes the fixed-layout algorithm discard the first row's column widths and every column
 * collapses to an equal share.
 */
.cw-cr .cw-cr__caption {
	position: absolute;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.cw-cr .cw-cr__scroll {
	overflow-x: auto;
	scrollbar-width: none;
}

.cw-cr .cw-cr__scroll::-webkit-scrollbar {
	display: none;
}

.cw-cr .cw-cr__table {
	width: 100%;
	min-width: var( --cw-cr-min-width, 1600px );
	table-layout: fixed;
	border-collapse: collapse;
	text-align: left;
	margin: 0;
}

/*
 * A second, visible scrollbar above the table. The real one sits below fifty-one rows and
 * is hidden anyway, so without this there is nothing on screen saying the table scrolls.
 * Hidden until the script measures the table and finds it actually overflows -- a bar that
 * cannot be dragged is worse than no bar.
 */
.cw-cr .cw-cr__bar {
	display: none;
	overflow-x: auto;
	overflow-y: hidden;
	background: #f1f2f4;
	border-bottom: 1px solid #000;
	scrollbar-width: thin;
	scrollbar-color: var(--cw-cr-link) var(--cw-cr-zebra);
}

.cw-cr .cw-cr__bar::-webkit-scrollbar {
	height: 10px;
}

.cw-cr .cw-cr__bar::-webkit-scrollbar-track {
	background: var(--cw-cr-zebra);
}

.cw-cr .cw-cr__bar::-webkit-scrollbar-thumb {
	background: var(--cw-cr-link);
}

.cw-cr .cw-cr__bar-spacer {
	height: 1px;
}

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

.cw-cr .cw-cr__th {
	padding: var( --cw-cr-cell-pad, 12px );
	background: #000;
	font-family: var(--cw-cr-font-main);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.06rem;
	text-transform: uppercase;
	color: #fff;
	text-align: left;
	vertical-align: bottom;
	border: 0;
}

/* ------------------------------------------------------------------ cells */

.cw-cr .cw-cr__td {
	padding: var( --cw-cr-cell-pad, 12px );
	vertical-align: top;
	font-family: var(--cw-cr-font-main);
	font-size: 16px;
	line-height: 1.6;
	color: var(--cw-cr-ink);
	background: #fff;
	border: 0;
}

.cw-cr .cw-cr__tr--alt .cw-cr__td {
	background: var(--cw-cr-zebra);
}

.cw-cr .cw-cr__td--result {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--cw-cr-bronze);
}

/* The uplift is a supporting figure, so it reads quieter than the result it derives from. */
.cw-cr .cw-cr__td--pct-increase {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--cw-cr-navy);
	white-space: nowrap;
}

.cw-cr .cw-cr__td--verdict-or-settlement {
	font-family: var(--cw-cr-font-serif);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
	letter-spacing: 0.04rem;
	text-transform: uppercase;
	color: var(--cw-cr-navy);
}

.cw-cr .cw-cr__dash {
	color: var(--cw-cr-ink-muted);
}

.cw-cr .cw-cr__link {
	color: var(--cw-cr-link);
	font-weight: 600;
	text-decoration: underline;
}

.cw-cr .cw-cr__link:hover,
.cw-cr .cw-cr__link:focus {
	text-decoration: none;
}

/* ------------------------------------------------------- scroll affordance */

/*
 * Sticky against the page scroll, not the table's own scroller. Its natural position is
 * the bottom of the frame, pulled back up over the last rows, so while you read the middle
 * of a fifty-row table it rides along the bottom of the viewport and settles into place as
 * the end of the table arrives.
 */
.cw-cr .cw-cr__hint {
	position: sticky;
	bottom: 20px;
	z-index: 4;
	width: fit-content;
	margin: -64px 16px 16px auto;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 16px;
	border-radius: 999px;
	background: rgba(7, 16, 37, 0.92);
	color: var(--cw-cr-gold);
	font-family: var(--cw-cr-font-main);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04rem;
	line-height: 1;
	white-space: nowrap;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
	pointer-events: none;
	opacity: 1;
	transition: opacity 320ms ease;
}

.cw-cr .cw-cr__hint[hidden] {
	display: none;
}

.cw-cr .cw-cr__hint.is-done {
	opacity: 0;
}

.cw-cr .cw-cr__hint-arrow {
	display: block;
	flex: none;
}

@media (prefers-reduced-motion: no-preference) {

	.cw-cr .cw-cr__hint-arrow {
		animation: cw-cr-nudge 1.6s ease-in-out infinite;
	}

}

@keyframes cw-cr-nudge {

	0%,
	100% {
		transform: translateX(0);
	}

	50% {
		transform: translateX(5px);
	}

}

/* ------------------------------------------------------------------- note */

.cw-cr .cw-cr__note {
	max-width: 1035px;
	margin-top: 56px;
	padding: 40px;
	background: var(--cw-cr-zebra);
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.cw-cr .cw-cr__note-text {
	margin: 0;
	font-family: var(--cw-cr-font-serif);
	font-size: 22px;
	line-height: 36px;
	font-weight: 500;
	color: var(--cw-cr-navy);
	text-wrap: pretty;
}

/*
 * Enclosed content -- on this site the "results will vary" line and the State Bar
 * attorney-advertising disclaimer. Set smaller than the headline note so the box reads as
 * one statement plus its small print.
 */
.cw-cr .cw-cr__note-extra {
	display: flex;
	flex-direction: column;
	gap: 12px;
	font-family: var(--cw-cr-font-main);
	font-size: 15px;
	line-height: 1.7;
	color: var(--cw-cr-ink-muted);
}

.cw-cr .cw-cr__note-extra p {
	margin: 0;
	text-wrap: pretty;
}

.cw-cr .cw-cr__note-extra a {
	color: var(--cw-cr-link);
	text-decoration: underline;
}

/* ------------------------------------------------------------ breakpoints */

@media (max-width: 1599px) {

	/* Set the property, not the padding: cells read it, presets override it, and an
	   explicit padding attribute (written inline) still wins over all of it. */
	.cw-cr {
		--cw-cr-cell-pad: 10px 9px;
	}

	.cw-cr .cw-cr__th {
		font-size: 11px;
	}

	.cw-cr .cw-cr__td {
		font-size: 15px;
	}

	.cw-cr .cw-cr__td--result {
		font-size: 17px;
	}

	.cw-cr .cw-cr__td--pct-increase {
		font-size: 15px;
	}

	.cw-cr .cw-cr__td--verdict-or-settlement {
		font-size: 13px;
	}

}

@media (max-width: 1279px) {

	.cw-cr {
		--cw-cr-cell-pad: 9px 7px;
	}

	.cw-cr .cw-cr__th {
		font-size: 10px;
	}

	.cw-cr .cw-cr__td {
		font-size: 14px;
	}

	.cw-cr .cw-cr__td--result {
		font-size: 15px;
	}

	.cw-cr .cw-cr__td--pct-increase {
		font-size: 14px;
	}

	.cw-cr .cw-cr__td--verdict-or-settlement {
		font-size: 12px;
	}

}

@media (max-width: 767px) {

	.cw-cr .cw-cr__title {
		font-size: 26px;
		line-height: 34px;
	}

	.cw-cr .cw-cr__intro {
		margin-bottom: 32px;
	}

	.cw-cr .cw-cr__note {
		margin-top: 32px;
		padding: 24px;
	}

	.cw-cr .cw-cr__note-text {
		font-size: 18px;
		line-height: 30px;
	}

	.cw-cr .cw-cr__note-extra {
		font-size: 14px;
	}

	.cw-cr .cw-cr__hint {
		bottom: 14px;
		margin: -56px 12px 12px auto;
		padding: 8px 14px;
		font-size: 12px;
	}

}


/* ------------------------------------------------- per-page modifiers */

/*
 * Density presets, for editors who want "tighter" without picking a number. An explicit
 * padding attribute writes the same property inline and therefore wins over these, which
 * is the precedence you would expect: the specific beats the preset.
 */
.cw-cr--compact {
	--cw-cr-cell-pad: 8px;
}

.cw-cr--roomy {
	--cw-cr-cell-pad: 18px;
}

.cw-cr--align-center {
	margin-left: auto;
	margin-right: auto;
}

.cw-cr--align-left {
	margin-left: 0;
	margin-right: auto;
}

/*
 * The first column is a <th scope="row">, so a screen reader can announce which case a
 * figure belongs to. Browsers centre and embolden th by default; it should read as a
 * slightly stronger cell, not as a heading in the middle of the table.
 */
.cw-cr .cw-cr__td--row {
	text-align: left;
	font-weight: 600;
}
