/*
 * BBQ Geek Brisket Hold Calculator
 * Every selector is scoped under .bbqgeek-bh so nothing leaks into your theme.
 * Restyle by overriding the custom properties on .bbqgeek-bh in your theme CSS.
 */

.bbqgeek-bh {
	--bh-bg: #ffffff;
	--bh-panel: #f6f4f1;
	--bh-panel-2: #efece7;
	--bh-ink: #1d1b19;
	--bh-ink-soft: #5c554e;
	--bh-line: #ddd6cd;
	--bh-accent: #b4451f;
	--bh-accent-ink: #ffffff;
	--bh-good: #2f7d44;
	--bh-warn: #a86a12;
	--bh-bad: #b32222;
	--bh-radius: 10px;

	box-sizing: border-box;
	max-width: 900px;
	margin: 1.5rem auto;
	padding: clamp(1rem, 3vw, 1.75rem);
	background: var(--bh-bg);
	color: var(--bh-ink);
	border: 1px solid var(--bh-line);
	border-radius: var(--bh-radius);
	font-size: 16px;
	line-height: 1.5;
}

.bbqgeek-bh *,
.bbqgeek-bh *::before,
.bbqgeek-bh *::after { box-sizing: inherit; }

/* ---------------------------------------------------------------------------
   Theme-proofing.

   WordPress themes style bare `button`, `input`, `select`, `label` and `table`
   elements aggressively, and those rules leak straight into plugin markup.
   This neutralises the usual offenders inside the calculator only.

   The :where() wrapper contributes zero specificity, so every rule further
   down this file still wins and the custom properties stay overridable — but
   a theme's element-level rules do not.
   ------------------------------------------------------------------------- */
.bbqgeek-bh :where(button, input, select, output, label, legend, summary,
	fieldset, details, table, caption, thead, tbody, tr, th, td,
	ul, ol, li, dl, dt, dd, p, h2, h3, span, div) {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	text-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	font-family: inherit;
	font-size: inherit;
	font-style: normal;
	font-weight: inherit;
	color: inherit;
	line-height: 1.5;
	min-height: 0;
	min-width: 0;
	max-width: none;
	height: auto;
	float: none;
	transform: none;
	transition: none;
	filter: none;
	vertical-align: baseline;
	text-align: inherit;
	outline: none;
}

.bbqgeek-bh :where(button, input:not([type="range"]), select) {
	appearance: none;
	-webkit-appearance: none;
	background-image: none;
}

.bbqgeek-bh :where(select) {
	/* Restore the native dropdown arrow the reset above just removed. */
	appearance: auto;
	-webkit-appearance: auto;
}

.bbqgeek-bh :where(button)::-moz-focus-inner { border: 0; padding: 0; }

@media (prefers-color-scheme: dark) {
	.bbqgeek-bh {
		--bh-bg: #17161a;
		--bh-panel: #201f24;
		--bh-panel-2: #2a282f;
		--bh-ink: #f2efeb;
		--bh-ink-soft: #a9a29b;
		--bh-line: #38353d;
		--bh-accent: #e2703a;
		--bh-accent-ink: #17161a;
		--bh-good: #5cc47c;
		--bh-warn: #e0a83c;
		--bh-bad: #ef6b6b;
	}
}

.bbqgeek-bh__title {
	margin: 0 0 1rem;
	font-size: 1.4rem;
	line-height: 1.25;
}

/* --- Units toggle --- */
/* A padded track holding two self-rounded pills. The active pill draws its
   own full border-radius and sits inset from the track edge, so it cannot
   spill past the rounded corners no matter what padding, border, margin or
   box-shadow a theme tries to put on the button. */
.bbqgeek-bh__units {
	display: inline-flex;
	align-items: stretch;
	gap: 2px;
	margin: 0 0 1.25rem;
	padding: 3px;
	border: 1px solid var(--bh-line);
	border-radius: 999px;
	background: var(--bh-panel);
}

.bbqgeek-bh__unit {
	display: inline-block;
	margin: 0;
	padding: 0.4rem 1rem;
	border: 0;
	border-radius: 999px;
	background: transparent;
	box-shadow: none;
	color: var(--bh-ink-soft);
	font: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	cursor: pointer;
}

.bbqgeek-bh__unit[aria-pressed="true"] {
	background: var(--bh-accent);
	color: var(--bh-accent-ink);
}

/* --- Form --- */
.bbqgeek-bh__group {
	margin: 0 0 1.25rem;
	padding: 1rem 1.1rem 0.35rem;
	border: 1px solid var(--bh-line);
	border-radius: var(--bh-radius);
	background: var(--bh-panel);
	min-width: 0;
}

.bbqgeek-bh__group legend {
	padding: 0 0.45rem;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--bh-ink-soft);
}

.bbqgeek-bh__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: 0.85rem 1rem;
}

.bbqgeek-bh__field {
	margin: 0 0 0.75rem;
	min-width: 0;
}

.bbqgeek-bh__field--wide { grid-column: 1 / -1; }

.bbqgeek-bh__field label {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.5rem;
	margin: 0 0 0.3rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--bh-ink-soft);
}

.bbqgeek-bh__field input[type="number"],
.bbqgeek-bh__field input[type="datetime-local"],
.bbqgeek-bh__field select {
	width: 100%;
	max-width: 100%;
	padding: 0.5rem 0.6rem;
	font: inherit;
	font-size: 0.95rem;
	color: var(--bh-ink);
	background: var(--bh-bg);
	border: 1px solid var(--bh-line);
	border-radius: 6px;
	margin: 0;
}

.bbqgeek-bh__field input[type="range"] {
	display: block;
	width: 100%;
	height: 1.4rem;
	margin: 0.35rem 0 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	min-height: 0;
	cursor: pointer;
	/* Native appearance paints both the filled portion and the thumb in every
	   current browser. Re-asserted here because a theme that sets
	   -webkit-appearance: none on inputs would otherwise leave a bare thumb
	   floating with no track behind it. */
	appearance: auto;
	-webkit-appearance: auto;
	accent-color: var(--bh-accent);
}

.bbqgeek-bh__field input:focus-visible,
.bbqgeek-bh__field select:focus-visible,
.bbqgeek-bh__btn:focus-visible,
.bbqgeek-bh__unit:focus-visible {
	outline: 2px solid var(--bh-accent);
	outline-offset: 2px;
}

.bbqgeek-bh__out {
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	color: var(--bh-ink);
}

.bbqgeek-bh__hint {
	display: block;
	margin-top: 0.3rem;
	font-size: 0.78rem;
	color: var(--bh-ink-soft);
}

.bbqgeek-bh__hint--warn { color: var(--bh-warn); font-weight: 600; }
.bbqgeek-bh__hint--bad { color: var(--bh-bad); font-weight: 600; }

/* --- Advanced bracket log --- */
.bbqgeek-bh__advanced {
	margin: 0 0 1.25rem;
	padding: 0.75rem 1.1rem;
	border: 1px solid var(--bh-line);
	border-radius: var(--bh-radius);
	background: var(--bh-panel);
}

.bbqgeek-bh__advanced summary {
	cursor: pointer;
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--bh-ink-soft);
}

.bbqgeek-bh__note {
	margin: 0.75rem 0;
	font-size: 0.82rem;
	color: var(--bh-ink-soft);
}

.bbqgeek-bh__brackets {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
	gap: 0.5rem 1rem;
}

.bbqgeek-bh__bracket {
	display: grid;
	grid-template-columns: 1fr 5rem auto;
	align-items: center;
	gap: 0.5rem;
}

.bbqgeek-bh__bracket-label {
	font-size: 0.85rem;
	font-variant-numeric: tabular-nums;
	color: var(--bh-ink-soft);
	margin: 0;
}

.bbqgeek-bh__bracket-hours {
	width: 100%;
	padding: 0.35rem 0.45rem;
	font: inherit;
	font-size: 0.9rem;
	color: var(--bh-ink);
	background: var(--bh-bg);
	border: 1px solid var(--bh-line);
	border-radius: 6px;
}

.bbqgeek-bh__exact {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	margin: 0;
	font-size: 0.72rem;
	color: var(--bh-ink-soft);
	white-space: nowrap;
}

.bbqgeek-bh__exact input { margin: 0; accent-color: var(--bh-accent); }

/* --- Buttons --- */
.bbqgeek-bh__actions { margin: 0.5rem 0 0.75rem; }

.bbqgeek-bh__btn {
	appearance: none;
	font: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	padding: 0.45rem 0.9rem;
	border-radius: 999px;
	cursor: pointer;
	background: var(--bh-accent);
	color: var(--bh-accent-ink);
	border: 1px solid var(--bh-accent);
}

.bbqgeek-bh__btn--ghost {
	background: transparent;
	color: var(--bh-ink-soft);
	border-color: var(--bh-line);
}

/* --- Results --- */
.bbqgeek-bh__results:empty { display: none; }

.bbqgeek-bh__headline {
	margin: 0 0 1rem;
	padding: 1rem 1.15rem;
	border-radius: var(--bh-radius);
	background: var(--bh-accent);
	color: var(--bh-accent-ink);
	font-size: clamp(1.05rem, 2.6vw, 1.3rem);
	font-weight: 700;
	line-height: 1.35;
}

.bbqgeek-bh__cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 0.75rem;
	margin: 0 0 1.1rem;
}

.bbqgeek-bh__card {
	padding: 0.8rem 0.9rem;
	background: var(--bh-panel);
	border: 1px solid var(--bh-line);
	border-radius: var(--bh-radius);
}

.bbqgeek-bh__card-label {
	display: block;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--bh-ink-soft);
	margin-bottom: 0.3rem;
}

.bbqgeek-bh__card-value {
	display: block;
	font-size: 1.3rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.2;
}

.bbqgeek-bh__card-sub {
	display: block;
	margin-top: 0.2rem;
	font-size: 0.76rem;
	color: var(--bh-ink-soft);
}

/* --- Banners --- */
.bbqgeek-bh__banner {
	margin: 0 0 1.1rem;
	padding: 0.75rem 0.95rem;
	border-radius: var(--bh-radius);
	border-left: 4px solid var(--bh-ink-soft);
	background: var(--bh-panel-2);
	font-size: 0.88rem;
}

.bbqgeek-bh__banner--good { border-left-color: var(--bh-good); }
.bbqgeek-bh__banner--warn { border-left-color: var(--bh-warn); }
.bbqgeek-bh__banner--bad { border-left-color: var(--bh-bad); }

.bbqgeek-bh__banner strong { display: block; margin-bottom: 0.15rem; }

/* --- Timeline --- */
.bbqgeek-bh__section-title {
	margin: 1.35rem 0 0.6rem;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--bh-ink-soft);
}

.bbqgeek-bh__timeline {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0 0 0 1.1rem;
	border-left: 2px solid var(--bh-line);
}

.bbqgeek-bh__timeline li {
	position: relative;
	margin: 0 0 0.7rem;
	font-size: 0.9rem;
}

.bbqgeek-bh__timeline li::before {
	content: "";
	position: absolute;
	left: -1.47rem;
	top: 0.45em;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--bh-accent);
}

.bbqgeek-bh__step-time {
	display: inline-block;
	min-width: 5.5rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* --- Matrix --- */
.bbqgeek-bh__scroller {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 0 0 1rem;
	border: 1px solid var(--bh-line);
	border-radius: var(--bh-radius);
}

.bbqgeek-bh__matrix {
	width: 100%;
	min-width: 520px;
	border-collapse: collapse;
	font-size: 0.85rem;
	font-variant-numeric: tabular-nums;
}

.bbqgeek-bh__matrix th,
.bbqgeek-bh__matrix td {
	padding: 0.45rem 0.55rem;
	border: 0;
	text-align: center;
	border-bottom: 1px solid var(--bh-line);
}

.bbqgeek-bh__matrix thead th {
	background: var(--bh-panel-2);
	font-size: 0.74rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--bh-ink-soft);
}

.bbqgeek-bh__matrix tbody th {
	text-align: left;
	background: var(--bh-panel);
	font-weight: 700;
	white-space: nowrap;
}

/* These backgrounds encode the legend, so a theme's zebra striping must not
   win. This is the one place !important is justified in this file. */
.bbqgeek-bh .bbqgeek-bh__matrix td.bbqgeek-bh__cell--peak {
	background: color-mix(in srgb, var(--bh-good) 26%, transparent) !important;
	font-weight: 700;
}
.bbqgeek-bh .bbqgeek-bh__matrix td.bbqgeek-bh__cell--good {
	background: color-mix(in srgb, var(--bh-good) 12%, transparent) !important;
}
.bbqgeek-bh .bbqgeek-bh__matrix td.bbqgeek-bh__cell--over {
	background: color-mix(in srgb, var(--bh-warn) 20%, transparent) !important;
}
.bbqgeek-bh .bbqgeek-bh__matrix td.bbqgeek-bh__cell--under {
	background: none !important;
	color: var(--bh-ink-soft);
}
.bbqgeek-bh .bbqgeek-bh__matrix td.bbqgeek-bh__cell--unsafe {
	background: color-mix(in srgb, var(--bh-bad) 16%, transparent) !important;
	color: var(--bh-ink-soft);
}

/* Legend swatches reuse the cell classes but are spans, not table cells. */
.bbqgeek-bh__swatch.bbqgeek-bh__cell--peak { background: color-mix(in srgb, var(--bh-good) 26%, transparent); }
.bbqgeek-bh__swatch.bbqgeek-bh__cell--good { background: color-mix(in srgb, var(--bh-good) 12%, transparent); }
.bbqgeek-bh__swatch.bbqgeek-bh__cell--over { background: color-mix(in srgb, var(--bh-warn) 20%, transparent); }
.bbqgeek-bh__swatch.bbqgeek-bh__cell--unsafe { background: color-mix(in srgb, var(--bh-bad) 16%, transparent); }

.bbqgeek-bh__row--unsafe th { color: var(--bh-bad); }

.bbqgeek-bh__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1rem;
	margin: 0 0 1rem;
	font-size: 0.76rem;
	color: var(--bh-ink-soft);
}

.bbqgeek-bh__swatch {
	display: inline-block;
	width: 0.75rem;
	height: 0.75rem;
	border-radius: 3px;
	margin-right: 0.3rem;
	vertical-align: -1px;
	border: 1px solid var(--bh-line);
}

/* --- Footer text --- */
.bbqgeek-bh__disclaimer,
.bbqgeek-bh__noscript {
	margin: 1.25rem 0 0;
	padding-top: 0.9rem;
	border-top: 1px solid var(--bh-line);
	font-size: 0.78rem;
	line-height: 1.55;
	color: var(--bh-ink-soft);
}

.bbqgeek-bh__breakdown {
	margin: 0 0 1rem;
	font-size: 0.82rem;
	color: var(--bh-ink-soft);
}

.bbqgeek-bh__breakdown dl {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.2rem 1rem;
	margin: 0.4rem 0 0;
}

.bbqgeek-bh__breakdown dt { margin: 0; }
.bbqgeek-bh__breakdown dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--bh-ink); }

@media (max-width: 520px) {
	.bbqgeek-bh__bracket { grid-template-columns: 1fr 4.5rem auto; }
	.bbqgeek-bh__step-time { display: block; min-width: 0; }
}
