/* CEdMA Enterprise capacity calculator. Styles follow Brand Guidelines v2.2. */

:root {
	--deep-slate: #1C2B3A;
	--slate-mid: #2D3F52;
	--aged-amber: #B8893A;
	--amber-light: #D4A85A;
	--amber-pale: #F5ECD8;
	--warm-white: #F7F5F2;
	--warm-grey: #EAE7E2;
	--warm-grey-dark: #C4BDB5;
	--signal-blue: #2563A8;
	--text-muted: #5A6472;
	--amber-text: #8C6420;
	--on-dark-muted: #B9C2CC;

	--font-display: "Cormorant Garamond", Georgia, serif;
	--font-body: "Albert Sans", "Segoe UI", Arial, sans-serif;
	--font-mono: "DM Mono", Consolas, "Courier New", monospace;

	--gutter: 40px;
	--max-width: 1280px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--warm-white);
	color: var(--slate-mid);
	font-family: var(--font-body);
	font-size: 17px;
	line-height: 1.6;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.wrap {
	width: 100%;
	max-width: calc(var(--max-width) + 2 * var(--gutter));
	margin: 0 auto;
	padding: 0 var(--gutter);
}

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

:focus-visible {
	outline: 3px solid var(--signal-blue);
	outline-offset: 2px;
}

/* Header and footer */
.site-header,
.site-footer {
	background: var(--deep-slate);
}
.site-header .wrap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 88px;
}

/* Back to main site: an outlined button on the dark header */
.main-site-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 8px 16px;
	border: 1.5px solid var(--amber-light);
	border-radius: 4px;
	color: var(--warm-white);
	font-weight: 600;
	font-size: 15px;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .12s ease;
}
.main-site-link::before { content: "\2190"; content: "\2190" / ""; }
.main-site-link:hover { background: var(--slate-mid); }
.main-site-link:focus-visible {
	outline: 3px solid var(--amber-light);
	outline-offset: 2px;
}
@media (max-width: 480px) {
	.site-header img { height: 40px; }
	.main-site-link { padding: 8px 12px; font-size: 14px; }
}
.site-header img {
	display: block;
	height: 48px;
	width: auto;
}
.site-footer {
	margin-top: auto;
	color: var(--on-dark-muted);
	font-size: 14px;
}
.site-footer .wrap {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 8px 24px;
	padding-top: 24px;
	padding-bottom: 24px;
}
.site-footer a {
	color: var(--warm-white);
	text-decoration: underline;
	text-decoration-color: var(--amber-light);
	text-underline-offset: 3px;
}
.site-footer a:focus-visible { outline-color: var(--amber-light); }

main { padding-bottom: 72px; }

/* Page head with the heading marker */
.page-head {
	position: relative;
	padding: 56px 0 32px;
	margin-bottom: 40px;
	border-bottom: 2px solid var(--aged-amber);
}
.page-head::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -5px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--aged-amber);
}

.label {
	margin: 0 0 12px;
	font-family: var(--font-mono);
	font-weight: 500;
	font-size: 13px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--amber-text);
}

h1 {
	margin: 0 0 16px;
	font-family: var(--font-display);
	font-weight: 600;
	font-size: clamp(44px, 6vw, 64px);
	line-height: 1.05;
	color: var(--deep-slate);
}
h1 em, h2 em {
	font-weight: 400;
	font-style: italic;
	color: var(--amber-text);
}

.lead {
	margin: 0;
	max-width: 62ch;
	font-weight: 300;
	font-size: 20px;
	line-height: 1.55;
	color: var(--slate-mid);
}

h2 {
	margin: 0 0 12px;
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 26px;
	line-height: 1.2;
	color: var(--deep-slate);
}

/* Course table */
.courses {
	border: 1px solid var(--warm-grey-dark);
	border-radius: 8px;
	overflow: hidden;
}

table {
	width: 100%;
	border-collapse: collapse;
}
.courses table { table-layout: fixed; }

thead th {
	background: var(--warm-grey);
	padding: 12px 16px;
	text-align: left;
	vertical-align: bottom;
	font-family: var(--font-mono);
	font-weight: 500;
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--slate-mid);
}
thead th.num { text-align: right; }

.courses tbody td {
	padding: 12px 16px;
	vertical-align: top;
	border-top: 1px solid var(--warm-grey);
}
.courses tbody tr:first-child td { border-top: 0; }

col.c-type     { width: 232px; }
col.c-duration { width: 128px; }
col.c-effort   { width: 336px; }
col.c-ai       { width: 84px; }
col.c-weeks    { width: 92px; }
col.c-remove   { width: 104px; }

.courses thead th, .courses tbody td { padding-left: 8px; padding-right: 8px; }
.courses thead th:first-child, .courses tbody td:first-child { padding-left: 16px; }
.courses thead th:last-child, .courses tbody td:last-child { padding-right: 16px; }

.cell-label {
	display: block;
	margin-bottom: 6px;
	font-family: var(--font-mono);
	font-weight: 500;
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--slate-mid);
}
/* On wide screens the column headers do this job */
@media (min-width: 1280px) {
	.cell-label,
	.ai-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	td.col-ai { text-align: center; }
}

/* AI assisted checkbox */
.ai-toggle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	cursor: pointer;
	font-size: 16px;
	color: var(--deep-slate);
}
.ai-toggle input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	position: relative;
	flex: none;
	width: 24px;
	height: 24px;
	margin: 0;
	border: 1.5px solid var(--warm-grey-dark);
	border-radius: 4px;
	background: var(--warm-white);
	cursor: pointer;
}
.ai-toggle input[type="checkbox"]:hover { border-color: var(--text-muted); }
.ai-toggle input[type="checkbox"]:checked {
	background: var(--aged-amber);
	border-color: var(--aged-amber);
}
.ai-toggle input[type="checkbox"]:checked::after {
	content: "";
	position: absolute;
	left: 7px;
	top: 3px;
	width: 6px;
	height: 11px;
	border: solid var(--deep-slate);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.ai-toggle input[type="checkbox"]:disabled {
	background: var(--warm-grey);
	border-color: var(--warm-grey);
	cursor: not-allowed;
}
.ai-toggle:has(input:disabled) { cursor: not-allowed; color: var(--text-muted); }
.ai-toggle input[type="checkbox"]:focus-visible {
	outline: 3px solid var(--signal-blue);
	outline-offset: 2px;
}

input[type="text"],
select {
	display: block;
	width: 100%;
	min-height: 44px;
	padding: 10px 12px;
	border: 1px solid var(--warm-grey-dark);
	border-radius: 4px;
	background-color: var(--warm-white);
	color: var(--deep-slate);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.4;
}
input[type="text"]::placeholder { color: var(--text-muted); opacity: 1; }
input[type="text"]:hover,
select:hover { border-color: var(--text-muted); }
input[type="text"]:focus-visible,
select:focus-visible {
	outline: 3px solid var(--signal-blue);
	outline-offset: 0;
	border-color: var(--signal-blue);
}

select {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 36px;
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%231C2B3A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
}

/* Duration with its unit (hrs or mins) inside the field */
.duration { position: relative; }
.duration input[type="text"] { padding-right: 52px; }
.duration-unit {
	position: absolute;
	top: 0;
	right: 12px;
	height: 44px;
	display: flex;
	align-items: center;
	font-family: var(--font-mono);
	font-size: 13px;
	color: var(--text-muted);
	pointer-events: none;
}

[aria-invalid="true"] {
	border-color: var(--amber-text) !important;
	background-color: var(--amber-pale) !important;
}

.field-error {
	margin: 6px 0 0;
	font-size: 14px;
	line-height: 1.4;
	color: var(--amber-text);
}
.field-error:empty { display: none; }

.row-note {
	margin: 6px 0 0;
	font-size: 14px;
	line-height: 1.4;
	color: var(--text-muted);
}
.row-note:empty { display: none; }

.weeks {
	min-height: 44px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-end;
	text-align: right;
}
.weeks-value {
	font-family: var(--font-mono);
	font-size: 17px;
	color: var(--deep-slate);
}
.weeks-note {
	font-size: 14px;
	line-height: 1.35;
	color: var(--text-muted);
}

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 20px;
	border-radius: 4px;
	border: 1.5px solid var(--aged-amber);
	font-family: var(--font-body);
	font-weight: 600;
	font-size: 16px;
	line-height: 1.2;
	color: var(--deep-slate);
	cursor: pointer;
	transition: background-color .12s ease, border-color .12s ease;
}
.btn-primary { background: var(--aged-amber); }
.btn-primary:hover { background: var(--amber-light); border-color: var(--amber-light); }
.btn-secondary { background: transparent; }
.btn-secondary:hover { background: var(--amber-pale); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-remove {
	min-height: 44px;
	padding: 8px 12px;
	border: 1px solid var(--warm-grey-dark);
	border-radius: 4px;
	background: transparent;
	font-family: var(--font-body);
	font-weight: 500;
	font-size: 15px;
	color: var(--slate-mid);
	cursor: pointer;
	white-space: nowrap;
}
.btn-remove:hover { border-color: var(--slate-mid); color: var(--deep-slate); background: var(--warm-grey); }

.actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin: 20px 0 48px;
}
.actions-end {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-left: auto;
}
.row-limit {
	font-size: 14px;
	color: var(--text-muted);
}
.row-limit:empty { display: none; }

/* Results panel with the emblem */
.results {
	position: relative;
	overflow: hidden;
	border-radius: 12px;
	background: var(--deep-slate);
	color: var(--warm-white);
	padding: 40px 48px 44px;
	margin-bottom: 56px;
}
.results .emblem {
	position: absolute;
	top: 50%;
	right: -40px;
	height: 150%;
	width: auto;
	transform: translateY(-50%);
	opacity: .32;
	pointer-events: none;
}
.results-content {
	position: relative;
	max-width: 640px;
}
.results .label { color: var(--amber-light); margin: 0; }

.results-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	margin-bottom: 24px;
}

/* Headcount or work hours switch, on a dark panel */
.view-switch {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}
.view-switch .switch-label {
	float: left;
	margin-right: 4px;
	padding: 0;
	font-size: 14px;
	color: var(--on-dark-muted);
}
.view-switch label {
	position: relative;
	display: inline-flex;
}
.view-switch input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}
.view-switch span {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 8px 16px;
	border: 1.5px solid var(--amber-light);
	border-radius: 4px;
	font-weight: 600;
	font-size: 15px;
	line-height: 1.2;
	color: var(--warm-white);
	transition: background-color .12s ease;
}
.view-switch input:hover + span { background: var(--slate-mid); }
.view-switch input:checked + span {
	background: var(--aged-amber);
	border-color: var(--aged-amber);
	color: var(--deep-slate);
}
.view-switch input:focus-visible + span {
	outline: 3px solid var(--amber-light);
	outline-offset: 2px;
}

/* Which figures each view shows */
.results[data-view="headcount"] .stat-hours,
.results[data-view="hours"] .stat-headcount { display: none; }
.stats {
	display: flex;
	flex-wrap: wrap;
	gap: 24px 64px;
	margin: 0 0 24px;
}
.stat { margin: 0; display: flex; flex-direction: column; }
.stat dt { order: 2; }
.stat dd {
	margin: 0;
	font-family: var(--font-mono);
	font-weight: 400;
	font-size: clamp(44px, 6vw, 60px);
	line-height: 1;
	letter-spacing: -0.01em;
	color: var(--warm-white);
}
.stat dt {
	margin-top: 10px;
	font-size: 15px;
	color: var(--on-dark-muted);
}
.summary {
	margin: 0;
	font-size: 16px;
	color: var(--on-dark-muted);
}
.summary.has-incomplete { color: var(--amber-light); }

/* Method note */
.method > p { max-width: 70ch; }

/* How the estimate works: text on the left, the calculation in a card */
.method-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
	gap: 32px 56px;
	align-items: start;
	margin-bottom: 8px;
}
.method-text p { margin: 0 0 14px; max-width: 62ch; }
.calc-card {
	background: var(--warm-grey);
	border-radius: 8px;
	padding: 28px 32px 30px;
}
.calc-card .label { margin: 0 0 18px; }
.calc-steps {
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: step;
}
.calc-steps li {
	counter-increment: step;
	position: relative;
	padding: 0 0 0 40px;
	margin: 0 0 18px;
}
.calc-steps li:last-child { margin-bottom: 0; }
.calc-steps li::before {
	content: counter(step);
	position: absolute;
	left: 0;
	top: 1px;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--deep-slate);
	color: var(--warm-white);
	font-family: var(--font-mono);
	font-size: 13px;
	line-height: 26px;
	text-align: center;
}
.calc-term {
	display: block;
	font-weight: 600;
	color: var(--deep-slate);
	line-height: 1.4;
}
.calc-formula {
	display: block;
	margin-top: 2px;
	font-family: var(--font-mono);
	font-size: 14px;
	line-height: 1.5;
	color: var(--slate-mid);
}
@media (max-width: 900px) {
	.method-grid { grid-template-columns: 1fr; }
	.calc-card { padding: 24px 22px 26px; }
}

/* Footer links */
.footer-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 24px;
}

/* Sources page */
.back-link {
	margin: 32px 0 0;
	font-size: 15px;
}
.back-link a {
	color: var(--signal-blue);
	text-decoration: underline;
	text-underline-offset: 3px;
}
.back-link a::before { content: "\2190\00a0"; content: "\2190\00a0" / ""; }
.back-link + .page-head { padding-top: 24px; }

.method p { margin: 0 0 12px; }
.method .method-text p { margin: 0 0 14px; }
.method h2:not(:first-child) { margin-top: 40px; }

/* Content types table */
.types-wrap {
	margin: 0 0 24px;
	border: 1px solid var(--warm-grey-dark);
	border-radius: 8px;
	overflow: hidden;
}
.types-table { font-size: 16px; line-height: 1.5; }
.types-table thead th { padding: 12px 16px; }
.types-table tbody th,
.types-table tbody td {
	padding: 14px 16px;
	text-align: left;
	vertical-align: top;
	border-top: 1px solid var(--warm-grey);
}
.types-table tbody th {
	font-weight: 600;
	color: var(--deep-slate);
	white-space: nowrap;
}
.types-table .num { text-align: right; white-space: nowrap; }
.types-table td.num { font-family: var(--font-mono); font-size: 15px; color: var(--deep-slate); }
.types-table td.na { font-family: var(--font-body); font-size: 15px; color: var(--text-muted); white-space: normal; }
@media (min-width: 901px) {
	.types-table { table-layout: fixed; }
	.types-table th:nth-child(1) { width: 210px; }
	.types-table th:nth-child(2) { width: 112px; }
	.types-table th:nth-child(5) { width: 120px; }
}
.types-table:not(.basis-table) tbody td:nth-child(2) { white-space: nowrap; }
@media (min-width: 901px) {
	.types-table.basis-table th:nth-child(1) { width: 30%; }
	.types-table.basis-table th:nth-child(2) { width: auto; }
}

@media (max-width: 900px) {
	.types-wrap { border: 0; border-radius: 0; overflow: visible; }
	.types-table thead { display: none; }
	.types-table, .types-table tbody, .types-table tr, .types-table th, .types-table td { display: block; width: 100%; }
	.types-table tbody tr {
		padding: 16px 20px;
		margin-bottom: 12px;
		border: 1px solid var(--warm-grey-dark);
		border-radius: 8px;
	}
	.types-table tbody th,
	.types-table tbody td { padding: 0; border: 0; white-space: normal; }
	.types-table tbody th { font-size: 17px; margin-bottom: 8px; }
	.types-table tbody td { margin-top: 8px; }
	.types-table .num { text-align: left; }
	.types-table tbody td::before {
		content: attr(data-label);
		display: block;
		margin-bottom: 2px;
		font-family: var(--font-mono);
		font-weight: 500;
		font-size: 12px;
		letter-spacing: 0.1em;
		text-transform: uppercase;
		color: var(--slate-mid);
	}
}

@media (max-width: 600px) {
	td.col-type, td.col-duration { grid-column: 1 / -1; }
}

.sources {
	max-width: 70ch;
	margin: 0 0 12px;
	padding-left: 20px;
}
.sources li { margin-bottom: 12px; }
.sources cite { font-style: italic; }

.method a {
	color: var(--signal-blue);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.noscript {
	padding: 16px 20px;
	margin-bottom: 24px;
	border-radius: 8px;
	background: var(--amber-pale);
	color: var(--deep-slate);
}

/* Narrow screens: each course becomes a card */
@media (max-width: 1279px) {
	:root { --gutter: 24px; }
	.courses thead { display: none; }
	.courses table, .courses tbody, .courses tr, .courses td { display: block; width: 100%; }
	.courses { border: 0; border-radius: 0; overflow: visible; }
	.courses tbody tr {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 16px;
		padding: 20px;
		margin-bottom: 16px;
		border: 1px solid var(--warm-grey-dark);
		border-radius: 8px;
	}
	colgroup { display: none; }
	.courses tbody td, .courses tbody td:first-child, .courses tbody td:last-child { padding: 0; border: 0; }
	td.col-name, td.col-effort, td.col-ai { grid-column: 1 / -1; }
	td.col-weeks .weeks { align-items: flex-start; text-align: left; min-height: 0; }
	td.col-remove { display: flex; align-items: flex-end; justify-content: flex-end; }
	.results { padding: 32px 28px 36px; }
	.results .emblem { right: -120px; }
}

@media (max-width: 480px) {
	:root { --gutter: 16px; }
	.page-head { padding-top: 40px; }
	.lead { font-size: 18px; }
	.actions .btn { flex: 1 1 auto; }
	.actions-end { margin-left: 0; flex: 1 1 100%; }
	.results .emblem { right: -230px; opacity: .24; }
}

/* Printing */
@media print {
	.site-header, .site-footer, .actions, .col-remove, .noscript { display: none !important; }
	body { background: none; font-size: 12pt; }
	.page-head { padding-top: 0; }
	.results { background: none; color: var(--deep-slate); border: 1px solid var(--warm-grey-dark); padding: 20px 24px; }
	.results .emblem, .view-switch { display: none; }
	.results .label { color: var(--amber-text); }
	.stat dd { color: var(--deep-slate); font-size: 32pt; }
	.stat dt, .summary, .summary.has-incomplete { color: var(--slate-mid); }
	input[type="text"], select { border-color: var(--warm-grey-dark); background: none; }
	tr { break-inside: avoid; }
}
