/* Medtruva Calculator — all rules are scoped under .mtc */
.mtc {
	/* Medtruva brand */
	--mtc-blue: #125d95;
	--mtc-teal: #009689;
	--mtc-mint: #5eead4;
	/* light theme (default) — matches the white Medtruva storefront */
	--mtc-fg: 10, 40, 62;
	--mtc-strong: #0a2a40;
	--mtc-text: #1b3346;
	--mtc-dim: rgba(27, 51, 70, 0.62);
	--mtc-card-bg: #ffffff;
	--mtc-bg-a: rgba(0, 150, 137, 0.10);
	--mtc-bg-b: rgba(18, 93, 149, 0.10);
	--mtc-line: rgba(18, 93, 149, 0.34);
	--mtc-accent-text: #007a6f;
	--mtc-inv-bg: #0a2a40;
	--mtc-inv-fg: #ffffff;
	--mtc-warn: #b7791f;
	--mtc-warn-text: #8a5a12;
	--mtc-bad: #d64545;
	--mtc-bad-text: #a63030;
	--mtc-H: 300px;
	--mtc-spring: cubic-bezier(0.25, 1.25, 0.4, 1);
	position: relative;
	container-type: inline-size;
	container-name: mtc;
	box-sizing: border-box;
	max-width: 1180px;
	margin: 0 auto 2rem;
	padding: clamp(1.1rem, 3vw, 2.5rem);
	color: var(--mtc-text);
	background:
		radial-gradient(60rem 30rem at 85% -10%, var(--mtc-bg-a), transparent 60%),
		radial-gradient(40rem 26rem at -10% 110%, var(--mtc-bg-b), transparent 60%),
		var(--mtc-card-bg);
	border: 1px solid var(--mtc-line);
	border-radius: 28px;
	font-family: inherit;
	line-height: 1.5;
}

/* optional dark theme: [medtruva_calculator theme="dark"] */
.mtc--dark {
	--mtc-fg: 255, 255, 255;
	--mtc-strong: #ffffff;
	--mtc-text: #eaf2f7;
	--mtc-dim: rgba(234, 242, 247, 0.55);
	--mtc-card-bg: #060d14;
	--mtc-bg-a: rgba(0, 150, 137, 0.18);
	--mtc-bg-b: rgba(18, 93, 149, 0.22);
	--mtc-line: rgba(var(--mtc-fg), 0.22);
	--mtc-accent-text: #5eead4;
	--mtc-inv-bg: #ffffff;
	--mtc-inv-fg: #06121a;
	--mtc-warn: #f5b942;
	--mtc-warn-text: #ffd98a;
	--mtc-bad: #ff6b6b;
	--mtc-bad-text: #ffb3b3;
}
.mtc *, .mtc *::before, .mtc *::after { box-sizing: border-box; }
.mtc p { margin: 0; }
.mtc [hidden] { display: none !important; }

/* header */
.mtc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.6rem; }
.mtc-title { margin: 0.6rem 0 0.4rem; font-size: clamp(1.6rem, 4vw, 2.6rem); line-height: 1.05; letter-spacing: -0.02em; font-weight: 800; color: var(--mtc-strong); text-transform: none; }
.mtc-title span { color: var(--mtc-dim); font-weight: 300; }
.mtc-sub { color: var(--mtc-dim); max-width: 44rem; font-size: 0.95rem; }
.mtc-chip { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.75rem; border-radius: 999px; background: rgba(0, 150, 137, 0.12); border: 1px solid rgba(0, 150, 137, 0.35); color: var(--mtc-accent-text); font-size: 0.75rem; }
.mtc-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--mtc-teal); }
.mtc-chip b { color: var(--mtc-strong); font-weight: 600; }
.mtc-ghost { flex: none; appearance: none; cursor: pointer; background: transparent; color: var(--mtc-dim); border: 1px solid var(--mtc-line); border-radius: 999px; padding: 0.55rem 1.1rem; font: inherit; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; transition: color .2s, background .2s; }
.mtc-ghost:hover { color: var(--mtc-strong); background: rgba(var(--mtc-fg), 0.06); }

/* layout */
.mtc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
.mtc-left, .mtc-right { min-width: 0; }
@container mtc (min-width: 900px) { .mtc-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }

/* results */
.mtc-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.mtc-results > * { min-width: 0; }
@container mtc (max-width: 520px) { .mtc-results { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mtc-results .mtc-card:last-child { grid-column: 1 / -1; } }
@container mtc (min-width: 600px) and (max-width: 899px) { .mtc-results { grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); } .mtc .mtc-hero { grid-column: auto; } }
.mtc-card, .mtc-panel { background: var(--mtc-panel); border: 1px solid var(--mtc-line); border-radius: 20px; padding: 1rem 1.1rem; backdrop-filter: blur(10px); }
.mtc-k { display: block; margin: 0 0 0.6rem; font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mtc-dim); }
.mtc-big { display: flex; align-items: baseline; gap: 0.4rem; font-size: clamp(2.4rem, 6vw, 3.6rem); line-height: 1; font-weight: 700; letter-spacing: -0.03em; color: var(--mtc-accent-text); font-variant-numeric: tabular-nums; transition: color .25s; }
.mtc-big small { font-size: 0.9rem; font-weight: 400; color: var(--mtc-dim); letter-spacing: 0; font-style: italic; }
.mtc-val { font-size: clamp(1.15rem, 2.4vw, 1.6rem); font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; word-break: break-word; }
.mtc-note { margin-top: 0.4rem !important; font-size: 0.72rem; color: var(--mtc-dim); }
.mtc-hero { grid-column: 1 / -1; border-color: rgba(0, 150, 137, 0.4); background: linear-gradient(160deg, rgba(0, 150, 137, 0.14), rgba(var(--mtc-fg), 0.03)); }
.mtc-hero.is-warn .mtc-big { color: var(--mtc-warn); }
.mtc-hero.is-over .mtc-big { color: var(--mtc-bad); }
.mtc-hero.is-over { border-color: rgba(255, 107, 107, 0.5); }

.mtc-msg { margin-top: 0.9rem !important; padding: 0.7rem 1rem; border-radius: 14px; font-size: 0.85rem; background: rgba(245, 185, 66, 0.12); border: 1px solid rgba(245, 185, 66, 0.45); color: var(--mtc-warn-text); }
.mtc-msg.is-error { background: rgba(255, 107, 107, 0.12); border-color: rgba(255, 107, 107, 0.45); color: var(--mtc-bad-text); }

/* inputs */
.mtc-inputs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.9rem; margin-top: 0.9rem; }
@container mtc (min-width: 600px) { .mtc-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mtc-panel { display: flex; flex-direction: column; }
.mtc-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; }
.mtc-row .mtc-k { margin: 0; }
.mtc-field { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin: 0.4rem 0 0.7rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--mtc-line); }
.mtc-field input { width: 100%; min-width: 0; background: transparent !important; border: 0 !important; box-shadow: none !important; outline: none; padding: 0 !important; color: var(--mtc-strong); font: inherit; font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; height: auto; }
.mtc-field input::-webkit-outer-spin-button, .mtc-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mtc-field:focus-within { border-bottom-color: var(--mtc-teal); }
.mtc-unit { color: var(--mtc-dim); font-size: 1.05rem; }
.mtc-steps { display: flex; gap: 0.5rem; margin-top: auto; }
.mtc-steps button, .mtc-chips button { flex: 1; appearance: none; cursor: pointer; height: 42px; border-radius: 12px; border: 1px solid transparent; background: rgba(var(--mtc-fg), 0.06); color: rgba(var(--mtc-fg), 0.8); font: inherit; font-size: 1.1rem; transition: background .2s, color .2s; padding: 0; }
.mtc-steps button:hover, .mtc-chips button:hover { background: rgba(var(--mtc-fg), 0.12); color: var(--mtc-strong); }
.mtc-chips { display: flex; gap: 0.4rem; margin-bottom: 0.7rem; }
.mtc-chips button { height: 32px; font-size: 0.75rem; }
.mtc-chips button.is-on { background: rgba(0, 150, 137, 0.25); border-color: rgba(0, 150, 137, 0.6); color: var(--mtc-strong); }
.mtc-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: rgba(var(--mtc-fg), 0.06); border: 1px solid var(--mtc-line); }
.mtc-seg button { appearance: none; cursor: pointer; border: 0; border-radius: 8px; padding: 0.3rem 0.8rem; background: transparent; color: var(--mtc-dim); font: inherit; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; transition: background .2s, color .2s; }
.mtc-seg button.is-on { background: var(--mtc-inv-bg); color: var(--mtc-inv-fg); font-weight: 700; }
.mtc-list { display: flex; flex-direction: column; gap: 0.5rem; }
.mtc-list button { appearance: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 0.85rem 1.1rem; border-radius: 14px; border: 1px solid var(--mtc-line); background: rgba(var(--mtc-fg), 0.04); color: var(--mtc-dim); font: inherit; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; transition: all .2s; }
.mtc-list button em { font-style: normal; font-weight: 400; opacity: 0.7; }
.mtc-list button:hover { color: var(--mtc-strong); }
.mtc-list button.is-on { background: var(--mtc-inv-bg); color: var(--mtc-inv-fg); border-color: var(--mtc-inv-bg); }

.mtc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1rem; }
.mtc-btn { appearance: none; cursor: pointer; border: 0; border-radius: 999px; padding: 0.7rem 1.3rem; font: inherit; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; color: #fff; background: linear-gradient(120deg, var(--mtc-blue), var(--mtc-teal)); transition: filter .2s, transform .2s; }
.mtc-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.mtc-btn-alt { background: transparent; border: 1px solid var(--mtc-line); color: var(--mtc-text); }
.mtc-btn-alt:hover { background: rgba(var(--mtc-fg), 0.06); }
.mtc-toast { font-size: 0.78rem; color: var(--mtc-accent-text); min-height: 1em; }
.mtc button:focus-visible, .mtc summary:focus-visible { outline: 2px solid var(--mtc-teal); outline-offset: 2px; }
.mtc-legal { margin-top: 1.4rem !important; font-size: 0.7rem; letter-spacing: 0.04em; color: rgba(var(--mtc-fg), 0.5); text-transform: uppercase; }

/* ---------- syringe ---------- */
.mtc-right { position: relative; display: flex; justify-content: center; align-items: center; min-height: 420px; padding: 3rem 0 2rem; border-radius: 28px; border: 1px solid var(--mtc-line); background: linear-gradient(180deg, rgba(var(--mtc-fg), 0.05), transparent); overflow: hidden; }
.mtc-glow { position: absolute; top: 55%; left: 50%; width: 220px; height: 220px; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(0, 150, 137, 0.22); filter: blur(80px); pointer-events: none; }
.mtc-syr { --fill: 0; position: relative; z-index: 1; width: 170px; height: calc(var(--mtc-H) * 2 + 20px + 90px); }
@container mtc (max-width: 899px) { .mtc-grid { --mtc-H: 200px; } .mtc-right { min-height: 0; } }

.mtc-needle { position: absolute; bottom: 0; left: 50%; width: 3px; height: 62px; margin-left: -1.5px; background: linear-gradient(90deg, #8a97a3, #eef3f6, #7b8792); border-radius: 0 0 2px 2px; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.mtc-hub { position: absolute; bottom: 60px; left: 50%; width: 18px; height: 14px; margin-left: -9px; border-radius: 3px; background: linear-gradient(180deg, #fb923c, #c2410c); border: 1px solid #9a3412; z-index: 3; }

.mtc-barrel { position: absolute; left: 50%; bottom: 72px; width: 66px; height: var(--mtc-H); margin-left: -33px; }
.mtc-glass { position: absolute; inset: 0; overflow: hidden; border: 2px solid rgba(var(--mtc-fg), 0.28); border-top: 0; border-radius: 0 0 16px 16px / 0 0 24px 24px; background: linear-gradient(90deg, rgba(var(--mtc-fg), 0.10), rgba(var(--mtc-fg), 0.02) 40%, rgba(var(--mtc-fg), 0.10)); z-index: 1; }
.mtc-liquid { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--fill) * 1%); background: linear-gradient(90deg, rgba(0, 110, 100, 0.95), rgba(0, 190, 172, 0.85) 45%, rgba(0, 110, 100, 0.95)); transition: height 0.9s var(--mtc-spring); }
.mtc-liquid i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.4); }
.mtc-liquid i:nth-child(1) { left: 22%; bottom: 14px; }
.mtc-liquid i:nth-child(2) { left: 68%; bottom: 34px; width: 3px; height: 3px; }
.mtc-liquid i:nth-child(3) { left: 40%; bottom: 60px; width: 2px; height: 2px; }
.mtc-shine { position: absolute; top: 0; bottom: 0; left: 22%; width: 5px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 80%); transform: skewX(-8deg); filter: blur(0.6px); }

.mtc-plunger { position: absolute; left: 50%; bottom: calc(var(--fill) * 1%); width: 60px; height: calc(var(--mtc-H) + 30px); margin-left: -30px; z-index: 2; transition: bottom 0.9s var(--mtc-spring); }
.mtc-seal { position: absolute; left: 3px; right: 3px; bottom: 0; height: 12px; border-radius: 3px 3px 5px 5px; background: linear-gradient(180deg, #2a2f35, #0a0c0f); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(var(--mtc-fg), 0.18); }
.mtc-seal::after { content: ""; position: absolute; left: 10%; right: 10%; top: 4px; height: 3px; border-radius: 2px; background: #000; opacity: 0.7; }
.mtc-rod { position: absolute; left: 50%; bottom: 12px; top: 8px; width: 10px; margin-left: -5px; background: linear-gradient(90deg, #aab4bd, #fff 50%, #98a3ad); border-left: 1px solid #6d7882; border-right: 1px solid #6d7882; }
.mtc-pad { position: absolute; top: 0; left: 50%; width: 52px; height: 9px; margin-left: -26px; border-radius: 999px; background: linear-gradient(180deg, #e7edf1, #9aa6b0); border: 1px solid #6d7882; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4); }
.mtc-flange { position: absolute; top: -5px; left: -14px; right: -14px; height: 8px; border-radius: 999px; background: linear-gradient(180deg, rgba(var(--mtc-fg), 0.45), rgba(var(--mtc-fg), 0.12)); border: 1px solid rgba(var(--mtc-fg), 0.35); z-index: 3; pointer-events: none; }

.mtc-marker { position: absolute; left: 100%; bottom: calc(var(--fill) * 1%); margin: 0 0 -10px 12px; z-index: 4; transition: bottom 0.9s var(--mtc-spring); }
.mtc-marker::before { content: ""; position: absolute; right: 100%; top: 50%; width: 10px; height: 1px; background: var(--mtc-teal); }
.mtc-marker b { display: block; padding: 0.15rem 0.5rem; border-radius: 8px; background: var(--mtc-teal); color: #fff; font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }

.mtc-syr.is-over .mtc-marker b { background: var(--mtc-bad); }
.mtc-scale { position: absolute; right: 50%; bottom: 72px; height: var(--mtc-H); width: 60px; margin-right: 40px; pointer-events: none; z-index: 4; }
.mtc-tick { position: absolute; right: 0; width: 6px; height: 1px; background: rgba(var(--mtc-fg), 0.45); }
.mtc-tick.is-major { width: 12px; background: rgba(var(--mtc-fg), 0.85); }
.mtc-tick b { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 9px; font-weight: 600; color: rgba(var(--mtc-fg), 0.75); font-variant-numeric: tabular-nums; }

/* ---------- guide ---------- */
.mtc-guide { --mtc-H: 0; padding-top: clamp(1.4rem, 3vw, 2.4rem); }
.mtc-guide p, .mtc-guide li { color: rgba(var(--mtc-fg), 0.82); font-size: 0.95rem; }
.mtc-h { margin: 2rem 0 0.7rem; font-size: clamp(1.15rem, 2.4vw, 1.5rem); letter-spacing: -0.01em; color: var(--mtc-strong); text-transform: none; }
.mtc-h:first-child { margin-top: 0; }
.mtc-formula { margin: 1rem 0; padding: 1rem 1.2rem; border-radius: 16px; background: rgba(0, 150, 137, 0.08); border: 1px solid rgba(0, 150, 137, 0.3); }
.mtc-formula p + p { margin-top: 0.4rem; }
.mtc-example { margin-top: 0.8rem !important; }
.mtc-table-wrap { overflow-x: auto; margin: 0.8rem 0 0.4rem; border-radius: 16px; border: 1px solid var(--mtc-line); }
.mtc-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; margin: 0; }
.mtc-table th, .mtc-table td { padding: 0.65rem 0.9rem; text-align: left; white-space: nowrap; border: 0; border-bottom: 1px solid var(--mtc-line); color: rgba(var(--mtc-fg), 0.85); background: transparent; }
.mtc-table thead th { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mtc-dim); background: rgba(var(--mtc-fg), 0.04); }
.mtc-table tbody tr:last-child td { border-bottom: 0; }
.mtc-table-narrow { max-width: 460px; }
.mtc-fine { font-size: 0.75rem !important; color: var(--mtc-dim) !important; }
.mtc-list-ol { margin: 0.6rem 0 0; padding-left: 1.3rem; }
.mtc-list-ol li { margin-bottom: 0.5rem; }
.mtc-faq details { margin-bottom: 0.6rem; border: 1px solid var(--mtc-line); border-radius: 14px; background: var(--mtc-panel); }
.mtc-faq summary { cursor: pointer; list-style: none; padding: 0.9rem 1.1rem; font-weight: 600; color: var(--mtc-strong); font-size: 0.95rem; }
.mtc-faq summary::-webkit-details-marker { display: none; }
.mtc-faq summary::after { content: "+"; float: right; color: var(--mtc-teal); font-size: 1.2rem; line-height: 1; }
.mtc-faq details[open] summary::after { content: "−"; }
.mtc-faq details p { padding: 0 1.1rem 1rem; }

@media (prefers-reduced-motion: reduce) {
	.mtc-liquid, .mtc-plunger, .mtc-marker, .mtc-big, .mtc-btn { transition: none; }
}
.mtc-table-wrap:has(.mtc-table-narrow) { max-width: 460px; }

/* theme-proofing: some themes style every <header>/<p>/<h2>/<label>; keep calculator internals predictable */
.mtc .mtc-head { position: static !important; height: auto !important; min-height: 0 !important; background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; width: auto !important; float: none !important; }
.mtc .mtc-val, .mtc .mtc-big, .mtc .mtc-note { overflow-wrap: anywhere; }
.mtc .mtc-val { font-size: clamp(1.05rem, 2.2cqw, 1.5rem); line-height: 1.2; }
.mtc .mtc-k { line-height: 1.3; }
.mtc .mtc-title { font-size: clamp(1.5rem, 5cqw, 2.4rem) !important; line-height: 1.1 !important; }
.mtc .mtc-sub { position: static; }
@container mtc (max-width: 520px) { .mtc .mtc-k { letter-spacing: 0.1em; } }
