/* Sugar Sense calculator pages (blood sugar converter, A1C, Time in Range).
   Uses the theme's semantic tokens (--white = card surface, --black = ink,
   --border, --surface), so light and dark themes both work with no overrides. */

.calc-intro {
	font-size: 18px;
	color: var(--text-mute-strong);
}

.calc-card {
	background: var(--white);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 24px;
	margin: 24px 0 32px;
	box-shadow: 0 8px 24px rgba(16, 40, 28, 0.06);
}

[data-theme="dark"] .calc-card {
	box-shadow: none;
}

.calc-convert-row {
	display: flex;
	align-items: flex-end;
	gap: 14px;
}

.calc-swap {
	font-size: 22px;
	line-height: 48px;
	color: var(--text-muted);
	flex: 0 0 auto;
}

.calc-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px 14px;
}

.calc-field {
	flex: 1 1 0;
	min-width: 0;
}

.calc-field label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--text-muted);
	margin-bottom: 6px;
}

.calc-field input {
	width: 100%;
	height: 48px;
	padding: 0 14px;
	font-size: 18px;
	font-weight: 700;
	color: var(--black);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	outline: none;
	-moz-appearance: textfield;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.calc-field input:focus {
	border-color: var(--brand);
	box-shadow: 0 0 0 3px rgba(30, 158, 85, 0.18);
}

.calc-field input::placeholder {
	color: var(--text-faint);
	font-weight: 500;
}

.calc-context,
.calc-result {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin: 16px 0 0;
	font-size: 15px;
	line-height: 1.6;
	color: var(--text-mute-strong);
}

/* display:flex above would beat the UA [hidden] rule and leave an empty dot
   visible before the first input; the guard keeps hidden rows truly hidden. */
.calc-context[hidden],
.calc-result[hidden],
.calc-results[hidden] {
	display: none;
}

.calc-result strong {
	color: var(--black);
}

.calc-results .calc-result {
	margin-top: 10px;
}

.calc-dot {
	flex: 0 0 auto;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--brand);
	transform: translateY(-1px);
}

.calc-fineprint {
	font-size: 13px;
	color: var(--text-faint);
}

.calc-noscript {
	margin: 16px 0 0;
	font-size: 15px;
	color: var(--text-mute-strong);
}

/* Chart tables: horizontal scroll on narrow phones, zone tinting on rows.
   The tint is decorative; the zone is always named in the row's text. */
.calc-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.calc-table-wrap .calc-chart {
	min-width: 420px;
}

.calc-chart .calc-zone-ok td {
	background: rgba(30, 158, 85, 0.08);
}

.calc-chart .calc-zone-warn td {
	background: rgba(253, 141, 56, 0.10);
}

.calc-chart .calc-zone-alert td {
	background: rgba(214, 69, 69, 0.08);
}

/* Embed snippet box on the converter page. */
.calc-embed {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
}

.calc-embed-code {
	width: 100%;
	padding: 12px 14px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
	line-height: 1.5;
	color: var(--black);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	resize: none;
	outline: none;
}

.calc-embed-code:focus {
	border-color: var(--brand);
}

.calc-copy-btn {
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 700;
	font-family: inherit;
	color: #FFFFFF;
	background: #15863F;
	border: 0;
	border-radius: 10px;
	cursor: pointer;
}

.calc-copy-btn:hover {
	background: #1E9E55;
}

.calc-copy-btn:disabled {
	opacity: 0.75;
	cursor: default;
}

/* Glossary page: quick-jump chip index + anchor offset under the fixed header. */
.glossary-index {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 20px 0 10px;
}

.glossary-index a {
	display: inline-block;
	padding: 6px 12px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--text-mute-strong);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 999px;
	text-decoration: none;
	transition: border-color 0.15s ease, color 0.15s ease;
}

.glossary-index a:hover {
	border-color: var(--brand);
	color: var(--black);
}

.glossary-page h2[id] {
	scroll-margin-top: 110px;
}

@media (max-width: 540px) {
	.calc-card {
		padding: 18px;
	}

	.calc-grid {
		grid-template-columns: 1fr;
	}

	.calc-convert-row {
		gap: 10px;
	}

	.calc-swap {
		display: none;
	}
}
