/*!
 * PupGauge Calculators - styles. Scoped to .pgc, mobile first.
 * Uses the theme's design tokens when present (--pg-*), with standalone fallbacks.
 */
.pgc {
	--pgc-accent: var(--pg-rust, #8a2b17);
	--pgc-accent-hover: var(--pg-rust-deep, #6f2211);
	--pgc-accent-soft: var(--pg-rust-soft, rgba(138, 43, 23, 0.08));
	--pgc-accent-line: var(--pg-rust-line, rgba(138, 43, 23, 0.28));
	--pgc-ink: var(--pg-ink, #1f1a17);
	--pgc-muted: var(--pg-muted, #685f59);
	--pgc-line: var(--pg-line, rgba(31, 26, 23, 0.14));
	--pgc-paper: var(--pg-paper, #efeae3);
	--pgc-card: var(--pg-white, #fff);
	--pgc-error: var(--pg-error, #a3290f);
	--pgc-focus: var(--pg-focus, #c2521f);
	--pgc-radius: var(--pg-radius-lg, 22px);
	--pgc-radius-sm: var(--pg-radius-sm, 12px);
	--pgc-display: var(--pg-font-display, inherit);
	color: var(--pgc-ink);
	font-size: 1rem;
	line-height: 1.5;
	margin: 0 0 2rem;
	-webkit-text-size-adjust: 100%;
	container-type: inline-size;
	container-name: pgc;
}
.pgc *, .pgc *::before, .pgc *::after { box-sizing: border-box; }
.pgc [hidden] { display: none !important; }
.pgc .pgc-sr {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.pgc-icon { flex: none; vertical-align: middle; }

/* ------------------------------------------------------------------ card */
.pgc__card {
	display: grid;
	gap: 0;
	background: var(--pgc-card);
	border: 1px solid var(--pgc-accent-line);
	border-radius: var(--pgc-radius);
	overflow: hidden;
}
.pgc__form { padding: 22px 18px 24px; min-width: 0; }
.pgc__result {
	background: var(--pgc-paper);
	padding: 22px 18px 26px;
	min-width: 0;
	outline: none;
	border-top: 1px solid var(--pgc-line);
}
@container pgc (min-width: 600px) {
	.pgc__form { padding: 32px 32px 34px; }
	.pgc__result { padding: 32px; }
}
@container pgc (min-width: 860px) {
	.pgc__card { grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr); }
	.pgc__form { padding: 44px 44px 44px; }
	.pgc__result { border-top: 0; border-left: 1px solid var(--pgc-line); padding: 44px 40px; }
}

.pgc__head { margin-bottom: 22px; }
.pgc-pill {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 5px 12px 5px 9px;
	border: 1px solid var(--pgc-accent-line);
	border-radius: 999px;
	color: var(--pgc-accent);
	font-size: 0.8125rem; font-weight: 500; line-height: 1.3;
	background: var(--pgc-card);
}
.pgc-pill .pgc-icon { width: 16px; height: 16px; }
.pgc .pgc__title {
	font-family: var(--pgc-display);
	font-size: clamp(1.625rem, 5.4vw, 2.25rem);
	font-weight: 500; line-height: 1.1; letter-spacing: -0.025em;
	margin: 14px 0 8px; color: var(--pgc-ink);
}
.pgc__lede { margin: 0; color: var(--pgc-muted); font-size: 0.975rem; max-width: 46ch; }

/* ---------------------------------------------------------------- fields */
.pgc-field, .pgc-seg, .pgc-chips { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.pgc-label, .pgc-seg legend.pgc-label, .pgc-chips legend {
	display: block; font-size: 0.9rem; font-weight: 600; margin: 0 0 8px; padding: 0; color: var(--pgc-ink);
}
.pgc-optional, .pgc-unit-echo { font-weight: 400; color: var(--pgc-muted); }
.pgc-hint { margin: 6px 0 0; font-size: 0.8125rem; color: var(--pgc-muted); }
.pgc-error {
	display: flex; gap: 6px; align-items: flex-start;
	margin: 8px 0 0; font-size: 0.875rem; font-weight: 500; color: var(--pgc-error);
}
.pgc-error .pgc-icon { width: 16px; height: 16px; margin-top: 2px; }

.pgc-input {
	display: block; width: 100%; min-height: 52px;
	padding: 12px 14px;
	font: inherit; font-size: 1rem; color: var(--pgc-ink);
	background: var(--pgc-card);
	border: 1px solid rgba(31, 26, 23, 0.24);
	border-radius: var(--pgc-radius-sm);
	-webkit-appearance: none; appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pgc-input::placeholder { color: #8d847e; }
.pgc-input:hover { border-color: rgba(31, 26, 23, 0.4); }
.pgc-input:focus { outline: none; border-color: var(--pgc-accent); box-shadow: 0 0 0 3px rgba(194, 82, 31, 0.28); }
.pgc-input[aria-invalid="true"] { border: 2px solid var(--pgc-error); padding: 11px 13px; }
.pgc input[type="date"].pgc-input { min-height: 52px; }
.pgc-grid2 { display: grid; gap: 0 14px; }
@container pgc (min-width: 520px) { .pgc-grid2 { grid-template-columns: 1fr 1fr; } }

.pgc-combo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.pgc-combo .pgc-seg { margin: 0; }
.pgc-combo .pgc-seg__track { height: 100%; flex-wrap: nowrap; }

/* segmented radio pills */
.pgc-seg__track {
	display: flex; flex-wrap: wrap; gap: 4px; padding: 4px;
	background: var(--pgc-paper);
	border-radius: 999px;
	width: fit-content; max-width: 100%;
}
.pgc__result .pgc-seg__track { background: var(--pgc-card); }
.pgc-seg__opt { position: relative; display: flex; }
.pgc-seg__opt input, .pgc-chip input {
	position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
}
.pgc-seg__opt span {
	display: flex; align-items: center; justify-content: center;
	min-height: 44px; min-width: 52px; padding: 0 16px;
	border-radius: 999px; font-size: 0.925rem; font-weight: 500; color: var(--pgc-ink);
	transition: background-color 0.15s ease, color 0.15s ease;
	white-space: nowrap;
}
.pgc-seg__opt:hover span { background: rgba(31, 26, 23, 0.06); }
.pgc-seg__opt input:checked + span { background: var(--pgc-accent); color: #fff; }
.pgc-seg__opt input:focus-visible + span { outline: 3px solid var(--pgc-focus); outline-offset: 2px; }
.pgc-combo .pgc-seg__opt span { min-width: 44px; padding: 0 12px; }

/* size chips */
.pgc-chips__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@container pgc (min-width: 480px) { .pgc-chips__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pgc-chip { position: relative; display: block; }
.pgc-chip__body {
	display: flex; flex-direction: column; justify-content: center; gap: 1px;
	min-height: 58px; height: 100%; padding: 9px 12px 9px 14px;
	border: 1px solid rgba(31, 26, 23, 0.2); border-radius: 14px; background: var(--pgc-card);
	transition: border-color 0.15s ease, background-color 0.15s ease;
}
.pgc-chip__name { font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding-right: 18px; }
.pgc-chip__meta { font-size: 0.75rem; color: var(--pgc-muted); line-height: 1.3; }
.pgc-chip:hover .pgc-chip__body { border-color: rgba(31, 26, 23, 0.4); }
.pgc-chip input:checked + .pgc-chip__body {
	border: 2px solid var(--pgc-accent); padding: 8px 11px 8px 13px; background: var(--pgc-accent-soft);
}
.pgc-chip input:checked + .pgc-chip__body .pgc-chip__name::after {
	content: ""; position: absolute; top: 12px; right: 12px; width: 16px; height: 16px; border-radius: 50%;
	background: var(--pgc-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
}
.pgc-chip input:focus-visible + .pgc-chip__body { outline: 3px solid var(--pgc-focus); outline-offset: 2px; }
.pgc-chips.is-invalid .pgc-chip__body { border-color: var(--pgc-error); }

/* optional earlier weigh-in */
.pgc-more { margin: 4px 0 18px; border-top: 1px solid var(--pgc-line); border-bottom: 1px solid var(--pgc-line); }
.pgc-more > summary {
	display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px;
	min-height: 52px; padding: 10px 28px 10px 0; position: relative;
	cursor: pointer; list-style: none; font-weight: 600; font-size: 0.95rem;
}
.pgc-more > summary::-webkit-details-marker { display: none; }
.pgc-more > summary .pgc-icon { position: absolute; right: 0; top: 50%; margin-top: -10px; transition: transform 0.2s ease; }
.pgc-more[open] > summary .pgc-icon { transform: rotate(180deg); }
.pgc-more__tag { font-weight: 400; font-size: 0.8125rem; color: var(--pgc-muted); }
.pgc-more > .pgc-grid2 { padding-bottom: 4px; }
.pgc-more > summary:focus-visible { outline: 3px solid var(--pgc-focus); outline-offset: 2px; border-radius: 6px; }

/* summary alert */
.pgc-summary {
	display: flex; gap: 10px; align-items: flex-start;
	margin: 0 0 18px; padding: 14px 16px;
	background: rgba(163, 41, 15, 0.07); border: 1px solid rgba(163, 41, 15, 0.35);
	border-radius: 14px; color: var(--pgc-error); font-size: 0.925rem;
}
.pgc-summary .pgc-icon { margin-top: 2px; }
.pgc-summary p { margin: 0; color: var(--pgc-ink); }
.pgc-summary__body { display: grid; gap: 10px; }
.pgc-summary__fix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- buttons */
.pgc-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pgc-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 12px;
	min-height: 54px; padding: 6px 7px 6px 24px;
	font: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2;
	color: #fff; background: var(--pgc-accent);
	border: 0; border-radius: 999px; cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease;
}
.pgc-btn:hover { background: var(--pgc-accent-hover); }
.pgc-btn:active { transform: translateY(1px); }
.pgc-btn:focus-visible { outline: 3px solid var(--pgc-focus); outline-offset: 3px; }
.pgc-btn__arrow {
	display: inline-flex; align-items: center; justify-content: center;
	width: 42px; height: 42px; border-radius: 50%; background: #fff; color: var(--pgc-accent);
}
.pgc-btn__arrow .pgc-icon { width: 18px; height: 18px; }
.pgc-btn--ghost { background: transparent; color: var(--pgc-ink); padding: 6px 20px; border: 1px solid var(--pgc-line); }
.pgc-btn--ghost:hover { background: rgba(31, 26, 23, 0.05); }
.pgc-btn--small { min-height: 44px; padding: 6px 18px; font-size: 0.9rem; }
@container pgc (max-width: 419px) {
	.pgc-actions .pgc-btn:not(.pgc-btn--ghost) { flex: 1 1 100%; justify-content: space-between; }
	.pgc-actions .pgc-btn--ghost { flex: 1 1 100%; }
}

/* ------------------------------------------------------------ empty state */
.pgc-empty { display: grid; justify-items: start; gap: 12px; }
@container pgc (max-width: 859px) { .pgc-empty { grid-template-columns: auto 1fr; align-items: center; } .pgc-empty__mark { width: 48px; height: 48px; } .pgc-empty__steps { display: none; } .pgc .pgc-empty__title { margin: 0; font-size: 1.2rem; } }
@container pgc (min-width: 860px) { .pgc-empty { padding-top: 40px; } }
.pgc-empty__mark {
	display: inline-flex; align-items: center; justify-content: center;
	width: 64px; height: 64px; border-radius: 50%; background: var(--pgc-card); color: var(--pgc-accent);
	border: 1px solid var(--pgc-accent-line);
}
.pgc-empty__mark .pgc-icon { width: 28px; height: 28px; }
.pgc .pgc-empty__title { font-family: var(--pgc-display); font-size: 1.5rem; letter-spacing: -0.02em; margin: 4px 0 0; font-weight: 500; }
.pgc-empty__steps { list-style: none; counter-reset: pgc; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.pgc-empty__steps li { counter-increment: pgc; display: flex; gap: 12px; align-items: center; color: var(--pgc-muted); font-size: 0.95rem; }
.pgc-empty__steps li::before {
	content: counter(pgc); flex: none; display: inline-flex; align-items: center; justify-content: center;
	width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--pgc-accent-line);
	color: var(--pgc-accent); font-weight: 600; font-size: 0.85rem; background: var(--pgc-card);
}

/* ---------------------------------------------------------------- results */
.pgc-res { display: grid; gap: 18px; animation: pgc-in 0.35s ease both; }
@keyframes pgc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pgc-res { animation: none; } .pgc * { transition: none !important; } }
.pgc-res__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.pgc .pgc-res__eyebrow { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--pgc-muted); }
.pgc .pgc-res__big { margin: -6px 0 0; line-height: 1; }
.pgc-res__num {
	font-family: var(--pgc-display);
	font-size: clamp(2.5rem, 11vw, 4rem); font-weight: 400; letter-spacing: -0.04em; color: var(--pgc-ink);
	overflow-wrap: anywhere;
}
.pgc-res__num--text { font-size: clamp(1.75rem, 7vw, 2.4rem); }
.pgc .pgc-res__sub { margin: -8px 0 0; color: var(--pgc-muted); font-size: 0.95rem; }
.pgc .pgc-res__title { font-family: var(--pgc-display); font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
.pgc .pgc-res__body { margin: 0; color: var(--pgc-ink); }

.pgc-badge {
	display: inline-flex; align-items: center; gap: 7px;
	padding: 5px 12px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600;
	background: var(--pgc-card); border: 1px solid var(--pgc-accent-line); color: var(--pgc-accent);
}
.pgc-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pgc-badge--wide::before { background: transparent; border: 2px solid currentColor; width: 9px; height: 9px; }
.pgc-badge--moderate::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); border: 2px solid currentColor; width: 9px; height: 9px; }

.pgc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; margin: 0; }
.pgc-stats--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pgc-stat { background: var(--pgc-card); border-radius: 14px; padding: 12px 14px; margin: 0; min-width: 0; }
.pgc-stat__label { font-size: 0.78rem; color: var(--pgc-muted); margin: 0 0 2px; }
.pgc-stat__value { font-family: var(--pgc-display); font-size: 1.25rem; font-weight: 500; letter-spacing: -0.01em; margin: 0; }
.pgc-meter { margin-top: 8px; height: 6px; border-radius: 99px; background: var(--pgc-paper); overflow: hidden; }
.pgc-meter__fill { display: block; height: 100%; border-radius: inherit; background: var(--pgc-accent); }

.pgc-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pgc-note { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; line-height: 1.45; padding: 11px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.65); }
.pgc-note .pgc-icon { margin-top: 1px; color: var(--pgc-accent); }
.pgc-note--warn { background: rgba(163, 41, 15, 0.08); }
.pgc-note--warn .pgc-icon { color: var(--pgc-error); }

/* chart */
.pgc-chart { margin: 0; background: var(--pgc-card); border-radius: 16px; padding: 12px 10px 6px; }
.pgc-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.pgc-chart__grid { stroke: rgba(31, 26, 23, 0.08); stroke-width: 1; }
.pgc-chart__tick { fill: var(--pgc-muted); font-size: 12px; }
.pgc-chart__axis { fill: var(--pgc-muted); font-size: 11px; }
.pgc-chart__band { fill: rgba(138, 43, 23, 0.14); }
.pgc-chart__line { fill: none; stroke: var(--pgc-accent); stroke-width: 2.5; stroke-linejoin: round; }
.pgc-chart__drop { stroke: var(--pgc-accent); stroke-width: 1; stroke-dasharray: 3 4; }
.pgc-chart__dot { fill: var(--pgc-accent); stroke: #fff; stroke-width: 3; }
.pgc-chart__today { fill: var(--pgc-ink); font-size: 13px; font-weight: 600; paint-order: stroke; stroke: #fff; stroke-width: 4px; }

.pgc-table-toggle, .pgc-how { border-top: 1px solid var(--pgc-line); }
.pgc-chart .pgc-table-toggle { margin: 6px 4px 0; border-top-color: rgba(31, 26, 23, 0.08); }
.pgc-table-toggle > summary, .pgc-how > summary {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	min-height: 48px; cursor: pointer; list-style: none; font-weight: 600; font-size: 0.925rem;
}
.pgc-table-toggle > summary::-webkit-details-marker, .pgc-how > summary::-webkit-details-marker { display: none; }
.pgc-table-toggle > summary::after, .pgc-how > summary::after {
	content: ""; width: 10px; height: 10px; flex: none; margin-right: 6px;
	border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px);
	transition: transform 0.2s ease;
}
.pgc-table-toggle[open] > summary::after, .pgc-how[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.pgc-table-toggle > summary:focus-visible, .pgc-how > summary:focus-visible { outline: 3px solid var(--pgc-focus); outline-offset: 2px; border-radius: 6px; }
.pgc-how { border-bottom: 1px solid var(--pgc-line); }
.pgc-how__body { padding: 0 0 12px; font-size: 0.925rem; color: var(--pgc-ink); }
.pgc-how__body p { margin: 0 0 10px; }
.pgc-table-wrap { overflow-x: auto; max-height: 280px; overflow-y: auto; }
.pgc-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.pgc-table th, .pgc-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid rgba(31, 26, 23, 0.08); white-space: nowrap; }
.pgc-table thead th { position: sticky; top: 0; background: var(--pgc-card); font-weight: 600; }
.pgc-inline-link { color: var(--pgc-accent); font-weight: 600; text-underline-offset: 3px; }
.pgc-inline-link:focus-visible { outline: 3px solid var(--pgc-focus); outline-offset: 2px; }

/* timeline */
.pgc-timeline__label { margin: 0 0 8px; font-size: 0.85rem; color: var(--pgc-muted); }
.pgc-timeline__track { position: relative; display: flex; gap: 3px; height: 40px; }
.pgc-timeline__seg {
	display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden;
	border-radius: 8px; background: rgba(138, 43, 23, 0.12); color: var(--pgc-ink);
}
.pgc-timeline__seg:first-child { border-radius: 999px 8px 8px 999px; }
.pgc-timeline__seg:last-of-type { border-radius: 8px 999px 999px 8px; }
.pgc-timeline__seg--young_adult { background: rgba(138, 43, 23, 0.2); }
.pgc-timeline__seg--mature_adult { background: rgba(138, 43, 23, 0.3); }
.pgc-timeline__seg--senior { background: rgba(58, 35, 32, 0.28); }
.pgc-timeline__seg.is-current { background: var(--pgc-accent); color: #fff; }
.pgc-timeline__name { font-size: 0.72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: clip; padding: 0 4px; }
.pgc-timeline__marker {
	position: absolute; top: -5px; bottom: -5px; width: 4px; margin-left: -2px; border-radius: 4px;
	background: var(--pgc-ink); box-shadow: 0 0 0 2px #fff;
}

/* footer */
.pgc-res__foot { display: grid; gap: 14px; }
.pgc-res__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pgc .pgc-link-btn {
	display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
	font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--pgc-ink);
	background: var(--pgc-card); border: 1px solid var(--pgc-line); border-radius: 999px; cursor: pointer;
}
.pgc-link-btn:hover { border-color: var(--pgc-accent-line); color: var(--pgc-accent); }
.pgc-link-btn:focus-visible { outline: 3px solid var(--pgc-focus); outline-offset: 2px; }
.pgc-next { display: grid; gap: 8px; }
@container pgc (min-width: 520px) { .pgc-next { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } }
.pgc .pgc-next__link {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	min-height: 52px; padding: 10px 16px; border-radius: 14px;
	background: var(--pgc-card); color: var(--pgc-ink); text-decoration: none; font-weight: 600; font-size: 0.925rem;
	border: 1px solid transparent;
}
.pgc-next__link .pgc-icon { color: var(--pgc-accent); }
.pgc-next__link:hover { border-color: var(--pgc-accent-line); }
.pgc-next__link:focus-visible { outline: 3px solid var(--pgc-focus); outline-offset: 2px; }
.pgc-disclaimer { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 0.8125rem; color: var(--pgc-muted); }
.pgc-disclaimer .pgc-icon { width: 16px; height: 16px; margin-top: 2px; }

.pgc--unavailable { padding: 18px 20px; border: 1px solid var(--pgc-line); border-radius: 14px; background: var(--pgc-paper); }

/* Resets against theme content styles (lists, tables, headings inside post content). */
.pgc .pgc-notes, .pgc .pgc-empty__steps { list-style: none; padding: 0; margin-left: 0; margin-right: 0; max-width: none; }
.pgc .pgc-notes li, .pgc .pgc-empty__steps li { margin: 0; }
.pgc li::marker { content: none; }
.pgc .pgc-table { margin: 0; border: 0; }
.pgc .pgc-table th, .pgc .pgc-table td { padding: 8px 6px; border-bottom: 1px solid rgba(31, 26, 23, 0.08); }
.pgc .pgc-table thead th { background: var(--pgc-card); }
.pgc p { max-width: none; }
.pgc .pgc-summary p, .pgc .pgc-how__body p:last-child { margin-bottom: 0; }
