/**
 * In The Kibble: dry-matter panel, Open Score, portion calculator.
 *
 * Same house constraint as the rest of the site's CSS: Tailwind runs with
 * preflight off and Bootstrap 5's Reboot has no global img rule, so nothing is
 * reset for us. Every block declares its own box-sizing and nothing here
 * escapes an `itk-` scope.
 */

.itk-nutrition,
.itk-score,
.itk-portions,
.itk-method {
	--itk-ink: #1c2431;
	--itk-muted: #6b7482;
	--itk-line: #e4e7ec;
	--itk-bg-soft: #f7f8fa;
	--itk-blue: #1c5a94;
	--itk-blue-soft: #e6f1fb;
	--itk-good: #1f6b45;
	--itk-warn: #8a5a00;
	--itk-bad: #a4262c;

	box-sizing: border-box;
	color: var(--itk-ink);
	line-height: 1.55;
	margin: 2.5rem 0;
}

.itk-nutrition *,
.itk-score *,
.itk-portions *,
.itk-method * {
	box-sizing: border-box;
}

.itk-nutrition-title,
.itk-score-title,
.itk-portions-title {
	font-size: 1.35rem;
	font-weight: 700;
	margin: 0 0 0.5rem;
}

.itk-nutrition-lede {
	color: var(--itk-muted);
	margin: 0 0 1rem;
	max-width: 44rem;
}

.itk-nutrition-missing {
	background: var(--itk-bg-soft);
	border-left: 4px solid var(--itk-muted);
	color: var(--itk-muted);
	margin: 0;
	padding: 0.85rem 1rem;
}

/* --------------------------------------------------------------- tables */

.itk-nutrition-scroll {
	overflow-x: auto;
}

.itk-nutrition-table {
	border-collapse: collapse;
	min-width: 30rem;
	width: 100%;
}

.itk-nutrition-table th,
.itk-nutrition-table td {
	border-bottom: 1px solid var(--itk-line);
	padding: 0.6rem 0.75rem;
	text-align: left;
}

.itk-nutrition-table thead th {
	border-bottom: 2px solid var(--itk-ink);
	color: var(--itk-muted);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.itk-nutrition-table tbody th {
	font-weight: 600;
}

/* Figures line up in columns, so they get tabular digits. */
.itk-num {
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

.itk-num--strong {
	font-weight: 700;
}

.itk-nutrition-note {
	color: var(--itk-muted);
	font-size: 0.88rem;
	margin: 0.85rem 0 0;
	max-width: 46rem;
}

/* ---------------------------------------------------------------- score */

.itk-score {
	background: var(--itk-bg-soft);
	border: 1px solid var(--itk-line);
	border-radius: 10px;
	padding: 1.4rem 1.3rem;
}

.itk-score-head {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	margin-bottom: 1.1rem;
}

.itk-score-figure {
	align-items: center;
	background: #fff;
	border: 3px solid var(--itk-muted);
	border-radius: 12px;
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	justify-content: center;
	min-width: 5.5rem;
	padding: 0.7rem 0.9rem;
}

.itk-score-figure--a { border-color: var(--itk-good); color: var(--itk-good); }
.itk-score-figure--b { border-color: #4a8f5f; color: #4a8f5f; }
.itk-score-figure--c { border-color: var(--itk-warn); color: var(--itk-warn); }
.itk-score-figure--d,
.itk-score-figure--e { border-color: var(--itk-bad); color: var(--itk-bad); }

.itk-score-total {
	font-size: 2.1rem;
	font-variant-numeric: tabular-nums;
	font-weight: 800;
	line-height: 1;
}

.itk-score-outof {
	color: var(--itk-muted);
	font-size: 0.7rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.itk-score-intro {
	flex: 1 1 18rem;
	min-width: 0;
}

.itk-score-intro p {
	color: var(--itk-muted);
	margin: 0;
}

.itk-score-components {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.itk-score-component {
	background: #fff;
	border: 1px solid var(--itk-line);
	border-radius: 8px;
	padding: 0.7rem 0.9rem;
}

.itk-score-component summary {
	align-items: baseline;
	cursor: pointer;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	list-style: revert;
}

.itk-score-component summary:focus-visible {
	outline: 2px solid var(--itk-blue);
	outline-offset: 2px;
}

.itk-score-label {
	flex: 1 1 12rem;
	font-weight: 620;
	min-width: 0;
}

.itk-score-value {
	color: var(--itk-muted);
	font-size: 0.88rem;
}

.itk-score-points {
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	white-space: nowrap;
}

.itk-score-note {
	color: var(--itk-muted);
	font-size: 0.92rem;
	margin: 0.55rem 0 0;
}

.itk-score-bar {
	background: var(--itk-line);
	border-radius: 999px;
	height: 4px;
	margin-top: 0.6rem;
	overflow: hidden;
}

.itk-score-bar span {
	background: var(--itk-blue);
	display: block;
	height: 100%;
}

.itk-score-caveat {
	color: var(--itk-muted);
	font-size: 0.88rem;
	margin: 1rem 0 0;
	max-width: 46rem;
}

/* ------------------------------------------------------------- portions */

.itk-portions {
	border: 1px solid var(--itk-line);
	border-radius: 10px;
	padding: 1.3rem;
}

.itk-portions-fields {
	display: grid;
	gap: 0.9rem;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	margin-bottom: 0.9rem;
}

.itk-portions-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.itk-portions-field > span:first-child {
	color: var(--itk-muted);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.itk-portions-input-row {
	display: flex;
	gap: 0.4rem;
}

.itk-portions-field input,
.itk-portions-field select {
	background: #fff;
	border: 1px solid #c9ced7;
	border-radius: 8px;
	color: var(--itk-ink);
	font-size: 1rem;
	min-width: 0;
	padding: 0.55rem 0.7rem;
	width: 100%;
}

.itk-portions-input-row select {
	flex: 0 0 5rem;
}

.itk-portions-field input:focus-visible,
.itk-portions-field select:focus-visible {
	outline: 2px solid var(--itk-blue);
	outline-offset: 1px;
}

.itk-portions-button {
	background: var(--itk-blue);
	border: 0;
	border-radius: 8px;
	color: #fff;
	cursor: pointer;
	font-size: 1rem;
	font-weight: 600;
	padding: 0.6rem 1.3rem;
}

.itk-portions-button:hover {
	background: #16496f;
}

.itk-portions-answer {
	background: var(--itk-blue-soft);
	border-left: 4px solid var(--itk-blue);
	border-radius: 8px;
	margin-top: 1rem;
	padding: 1rem 1.1rem;
}

.itk-portions-headline {
	font-size: 1.15rem;
	margin: 0;
}

.itk-portions-portions,
.itk-portions-range {
	color: var(--itk-muted);
	font-size: 0.93rem;
	margin: 0.45rem 0 0;
}

.itk-portions-working {
	margin-top: 0.7rem;
}

.itk-portions-working summary {
	color: var(--itk-blue);
	cursor: pointer;
	font-size: 0.88rem;
}

.itk-portions-steps {
	color: var(--itk-muted);
	font-size: 0.88rem;
	margin: 0.5rem 0 0;
	padding-left: 1.2rem;
}

.itk-portions-error {
	color: var(--itk-bad);
	margin: 1rem 0 0;
}

.itk-portions-caveat {
	color: var(--itk-muted);
	font-size: 0.85rem;
	margin: 1rem 0 0;
	max-width: 46rem;
}

/* ---------------------------------------------------------- methodology */

.itk-method {
	max-width: 46rem;
}

.itk-method-lede {
	font-size: 1.1rem;
}

.itk-method h2 {
	font-size: 1.25rem;
	margin: 2rem 0 0.6rem;
}

.itk-method-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.itk-method-list li {
	border-left: 3px solid var(--itk-line);
	padding-left: 0.8rem;
}

.itk-method-list strong {
	display: block;
}

.itk-method-version {
	border-top: 1px solid var(--itk-line);
	color: var(--itk-muted);
	font-size: 0.85rem;
	margin-top: 2rem;
	padding-top: 1rem;
}

/* ---------------------------------------------------- ingredients + salt */

.itk-ingredients {
	--itk-ink: #1c2431;
	--itk-muted: #6b7482;
	--itk-line: #e4e7ec;
	--itk-bg-soft: #f7f8fa;
	--itk-blue: #1c5a94;
	--itk-salt: #8a5a00;
	--itk-salt-soft: #fdf1dc;

	border: 1px solid var(--itk-line);
	border-radius: 10px;
	box-sizing: border-box;
	color: var(--itk-ink);
	line-height: 1.55;
	margin: 2.5rem 0;
	padding: 1.3rem;
}

.itk-ingredients * {
	box-sizing: border-box;
}

.itk-ingredients-title {
	font-size: 1.35rem;
	font-weight: 700;
	margin: 0 0 0.5rem;
}

.itk-ingredients-note {
	color: var(--itk-muted);
	margin: 0 0 1rem;
	max-width: 46rem;
}

.itk-ingredients-note strong {
	color: var(--itk-ink);
}

.itk-ingredients-note--unknown {
	background: var(--itk-bg-soft);
	border-left: 4px solid var(--itk-muted);
	border-radius: 6px;
	padding: 0.7rem 0.9rem;
}

.itk-ingredients-list {
	counter-reset: none;
	display: flex;
	flex-direction: column;
	list-style: none;
	margin: 0;
	padding: 0;
}

.itk-ingredient {
	align-items: baseline;
	border-bottom: 1px solid var(--itk-line);
	display: flex;
	gap: 0.6rem;
	padding: 0.4rem 0.2rem;
}

.itk-ingredient-pos {
	color: var(--itk-muted);
	flex: 0 0 1.6rem;
	font-size: 0.78rem;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.itk-ingredient-name {
	min-width: 0;
}

/*
 * Everything below the divider is dimmed rather than hidden. It is still on the
 * label and the reader is entitled to see it; the point is that it is present
 * in a smaller amount than the salt, not that it is a secret.
 */
.itk-ingredient--after .itk-ingredient-name {
	color: var(--itk-muted);
}

.itk-ingredient--salt {
	background: var(--itk-salt-soft);
	border-radius: 4px;
	font-weight: 700;
}

.itk-ingredient--salt .itk-ingredient-name {
	color: var(--itk-salt);
}

.itk-salt-divider {
	align-items: center;
	border-top: 2px dashed var(--itk-salt);
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 0.7rem;
	list-style: none;
	margin: 0.5rem 0 0.6rem;
	padding-top: 0.5rem;
}

.itk-salt-divider-label {
	background: var(--itk-salt);
	border-radius: 999px;
	color: #fff;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	padding: 0.18rem 0.6rem;
	text-transform: uppercase;
}

.itk-salt-divider-note {
	color: var(--itk-salt);
	font-size: 0.85rem;
}

.itk-ingredients-caveat {
	color: var(--itk-muted);
	font-size: 0.88rem;
	margin: 1rem 0 0;
	max-width: 46rem;
}
