/* RoofClarity calculators (round 2 "small instrument"). Tokens from main.css only.
   Amber: price numbers, primary button, measurement marks. Everything else ink. */

.calc-answer a { color: var(--ink); }
.chero h1 + .calc-answer { margin-bottom: 0; }

/* Hero side card: path A (address) */
.calc-path { display: grid; gap: 12px; align-content: start; }
.calc-path__h { font-family: var(--f-display) !important; font-weight: 700 !important; font-size: clamp(22px, 2.2vw, 28px) !important; letter-spacing: -.015em !important; line-height: 1.2 !important; color: var(--on-dark) !important; margin: 0 !important; }
.calc-path .btn { justify-self: start; }
.calc-path .chero__stamp { margin: 0; color: var(--on-dark-2); }
.calc-path__row { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--glass-line); }
.calc-path__row b { font-family: var(--f-num) !important; font-size: clamp(20px, 2vw, 26px) !important; margin: 0 !important; color: var(--accent) !important; white-space: nowrap; }

/* Tool */
.calc-sec { padding-block: clamp(28px, 4vw, 56px) clamp(44px, 5.5vw, 80px); scroll-margin-top: 88px; }
.calc-sec > .wrap > h2:not(.sr-only) { font-size: clamp(26px, 3vw, 38px); margin-bottom: 20px; }
.calc { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(16px, 2.4vw, 32px); align-items: start; }
.calc__in { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); padding: clamp(18px, 2.6vw, 32px); display: grid; gap: 18px; }
.calc__in .field label a { color: var(--muted); font-weight: 500; }
.calc__in .field__hint { margin: 0; font-size: 14px; }
.calc__in [hidden] { display: none !important; }

/* Segmented choice (radio pills) */
.calc-seg { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.calc-seg--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Rendered legend sits above the grid (no float: Chromium dropped the 2nd option to a new row). The pill tint lives on the labels. */
.calc-seg legend { padding: 0 0 8px 2px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.calc-seg label { background: var(--bg-2); padding: 4px 2px; }
.calc-seg label:first-of-type { border-radius: 999px 0 0 999px; padding-left: 4px; }
.calc-seg label:last-of-type { border-radius: 0 999px 999px 0; padding-right: 4px; }
.calc-seg label { position: relative; cursor: pointer; }
.calc-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.calc-seg span { display: grid; place-items: center; min-height: 44px; padding: 0 10px; border-radius: 999px; font-weight: 600; font-size: 15px; text-align: center; color: var(--ink-2); transition: background-color .25s var(--ease), color .25s var(--ease); }
.calc-seg input:checked + span { background: var(--ink); color: var(--surface); }
.calc-seg input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* Live result card */
.calc-out { position: sticky; top: 112px; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-lg); padding: clamp(20px, 2.6vw, 32px); display: grid; gap: 14px; align-content: start; }
.calc-out__k { margin: 0; font-size: 15px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.calc-out__range { display: block; font-family: var(--f-num); font-weight: 700; font-size: clamp(30px, 3.4vw, 46px); letter-spacing: -.035em; line-height: 1.08; font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; }
[data-calc="cost"] .calc-out__range { color: var(--accent-text); }
.calc-out__empty { font-family: var(--f-body); font-size: 16px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.calc-out__sub { font-size: 17px; margin-top: 6px; }
.calc-out__facts { margin: 0; }
.calc-out__facts > div { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); }
.calc-out__facts dt { font-size: 15px; color: var(--ink-2); }
.calc-out__facts dt i { display: block; font-style: normal; font-size: 13px; color: var(--muted); }
.calc-out__facts dd { margin: 0; font-weight: 600; font-size: 16px; text-align: right; font-variant-numeric: tabular-nums; }
.calc-out__note { margin: 0; font-size: 14.5px; color: var(--muted); }
.calc-out__note:empty { display: none; }
.calc-out .btn { justify-self: start; }
.calc-out [hidden] { display: none !important; }

/* Tables */
.calc-tables { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 56px); margin-top: clamp(32px, 4vw, 56px); }
.calc-tables--one { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
.calc-tables h3 { margin-bottom: 10px; }
.calc-tbl { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.calc-tbl caption:not(.sr-only) { text-align: left; font-size: 14.5px; color: var(--muted); padding-bottom: 8px; }
.calc-tbl th, .calc-tbl td { padding: 11px 0; border-top: 1px solid var(--line); vertical-align: top; }
.calc-tbl tbody th { text-align: left; font-weight: 500; padding-right: 16px; }
.calc-tbl td { text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc-tbl--cols thead th { font-size: 13.5px; font-weight: 500; color: var(--muted); text-align: right; border-top: 0; padding-top: 0; }
.calc-tbl--cols thead th:first-child { text-align: left; }
.calc-tbl--cols td + td { padding-left: 14px; }
.calc-tbl tr.is-on th, .calc-tbl tr.is-on td { font-weight: 700; }
.calc-tbl tr.is-on th, .calc-tbl tr.is-on td { background: var(--bg-2); }
.calc-tbl tr.is-on th { padding-left: 10px; border-radius: 10px 0 0 10px; }
.calc-tbl tr.is-on td:last-child { padding-right: 10px; border-radius: 0 10px 10px 0; }
.calc-tbl__total th, .calc-tbl__total td { font-weight: 700; border-top: 1.5px solid var(--line-2); color: var(--accent-text); }
.calc-tbl__total th { color: var(--ink); }
.calc-tbl__ref th, .calc-tbl__ref td { color: var(--muted); }
.calc-tbl__ref td.calc-amber { color: var(--muted); }
.calc-amber { color: var(--accent-text); }
.calc-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--bg-2); font-size: 12px; font-weight: 600; vertical-align: 2px; }
.calc-scroll { overflow-x: auto; min-width: 0; }
.calc-size { min-width: 520px; }

/* Doc sections: sticky head left, body right */
.calc-doc__grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(24px, 5vw, 80px); align-items: start; }
.calc-doc__head { position: sticky; top: 112px; }
.calc-doc__head .lede { margin-top: 14px; }
.calc-doc--how { background: var(--surface); }
.calc-steps { list-style: none; margin: 0; padding: 0; counter-reset: cs; }
.calc-steps li { counter-increment: cs; display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.calc-steps li::before { content: counter(cs); grid-row: span 2; width: 30px; height: 30px; border-radius: 999px; background: var(--bg-2); display: grid; place-items: center; font: 600 14px var(--f-num); }
.calc-steps b { font-weight: 600; }
.calc-steps span { color: var(--ink-2); font-size: 15.5px; overflow-wrap: anywhere; }
.calc-steps__total span { font-weight: 700; font-size: clamp(20px, 2vw, 26px); color: var(--accent-text); }
.calc-formula { margin: 0 0 22px; padding: 18px 20px; border-radius: var(--r-in); background: var(--bg); font: 500 14.5px/1.7 var(--f-num); font-variant-numeric: tabular-nums; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.calc-bullets { margin: 0 0 22px; padding-left: 1.1em; color: var(--ink-2); }
.calc-bullets li { margin-bottom: 10px; }
.calc-src { margin: 0; padding: 0; list-style: none; font-size: 14.5px; }
.calc-src li { padding: 8px 0; border-top: 1px solid var(--line); }
.calc-src a { color: var(--ink-2); }
.calc-fl .calc-bullets { margin-top: 22px; }

/* Pitch drawing: amber line is a measurement mark */
.calc-tri { width: 100%; max-width: 360px; height: auto; }
.calc-tri__base { stroke: var(--line-2); stroke-width: 2; fill: none; }
.calc-tri__roof { fill: var(--bg-2); stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; transition: d .4s var(--ease); }

/* Hub: unequal cards on a 12-column grid */
.calc-hub h2 { max-width: 14em; }
.calc-hub__grid { list-style: none; margin: clamp(24px, 3vw, 40px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.calc-card a { height: 100%; display: grid; gap: 8px; align-content: start; padding: clamp(20px, 2.4vw, 30px); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.calc-card a:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.calc-card b { font-family: var(--f-display); font-weight: 700; font-size: clamp(20px, 1.9vw, 24px); letter-spacing: -.015em; line-height: 1.15; }
.calc-card span { color: var(--ink-2); font-size: 15.5px; }
.calc-card__ico { width: 30px; height: 30px; color: var(--ink-2); }
.calc-card { grid-column: span 5; }
.calc-card--lead { grid-column: span 7; grid-row: span 2; }
.calc-card--lead a { background: var(--stage-bg); color: var(--on-dark); align-content: end; min-height: 320px; }
.calc-card--lead span { color: var(--on-dark-2); font-size: 16.5px; max-width: 30em; }
.calc-card--lead .calc-card__ico { color: var(--on-dark-2); }
.calc-card--lead em { font-style: normal; font-family: var(--f-num); font-weight: 700; font-size: clamp(26px, 3vw, 40px); letter-spacing: -.03em; color: var(--accent); margin-top: 10px; }
.calc-card--lead em small { display: block; font: 400 14px var(--f-body); letter-spacing: 0; color: var(--on-dark-2); }
.calc-card--small b { font-size: clamp(18px, 1.6vw, 21px); }
.calc-card--wide { grid-column: 1 / -1; }
.calc-card--wide a { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.4fr); align-items: center; gap: 18px; }

/* Related tools as rows */
.calc-rel__grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(20px, 5vw, 80px); align-items: start; }
.calc-rel h2 { font-size: clamp(28px, 3vw, 40px); }
.calc-rel__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.calc-rel__list a { display: grid; grid-template-columns: minmax(0, 1fr) 20px; column-gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.calc-rel__list b { font-weight: 600; }
.calc-rel__list span { grid-column: 1; color: var(--muted); font-size: 15px; }
.calc-rel__list svg { grid-column: 2; grid-row: 1 / span 2; align-self: center; width: 18px; height: 18px; transition: transform .5s var(--ease); }
.calc-rel__list a:hover svg { transform: translateX(3px); }

#calculator, #example, #method, #by-size, #chart, #florida, #calculators { scroll-margin-top: 88px; }

@media (max-width: 900px) {
	.calc, .calc-tables, .calc-doc__grid, .calc-rel__grid { grid-template-columns: minmax(0, 1fr); }
	.calc-out, .calc-doc__head { position: static; }
	.calc-card, .calc-card--lead { grid-column: 1 / -1; grid-row: auto; }
	.calc-card--lead a { min-height: 260px; }
	.calc-card--wide a { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
	.calc__in .fgrid { grid-template-columns: minmax(0, 1fr); }
	.calc-seg span { font-size: 14px; padding: 0 6px; }
	.calc-tbl { font-size: 14.5px; }
	.calc-tbl--metal td:last-child, .calc-tbl--metal th:last-child { display: none; }
	.calc-out__facts > div { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
	.calc-card a, .calc-tri__roof, .calc-rel__list svg, .calc-seg span { transition: none; }
}
