/* 45Z Calculator - built on Merge Impact's design system (assets/merge.css).
   Reuses Merge tokens, site-header, site-footer, and logo. This file adds the
   calculator-specific layout + results visuals (45z.ag-inspired). */
:root {
  /* Alias Merge's tokens so the calculator CSS reads cleanly. */
  --ink: var(--color-ink);
  --ink-soft: var(--color-ink-soft);
  --muted: var(--color-muted);
  --primary: var(--color-primary);
  --primary-deep: var(--color-primary-deep);
  --teal: var(--color-teal);
  --teal-soft: var(--color-teal-soft);
  --green: var(--color-green);
  --green-soft: var(--color-green-soft);
  --surface: var(--color-surface);
  --surface-alt: var(--color-surface-alt);
  --card: #ffffff;
  --line: var(--color-line);
  --danger: #b4453a;
  --gold: #b9892f;
  --font: var(--font-merge-sans);
  --radius: var(--radius-card);
  --shadow: var(--shadow-card);
}
h1, h2, h3, h4 { font-family: var(--font-merge-sans); font-weight: 800; letter-spacing: -0.01em; margin: 0; }
small { color: var(--muted); }

/* Merge-styled page intro (clears the fixed site-header). */
.calc-hero { padding: 120px 0 30px; background:
  radial-gradient(120% 140% at 50% -20%, rgba(61,109,149,0.12), transparent 60%), var(--surface);
  border-bottom: 1px solid var(--line); text-align: center; }
.calc-hero .container { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.calc-hero__badge { color: var(--green); font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.calc-hero h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); color: var(--primary-deep); }
.calc-hero p { margin: 2px auto 0; max-width: 640px; color: var(--ink-soft); font-weight: 500; }

.workspace { width: min(100% - 40px, var(--container)); margin: 0 auto; padding: 26px 0 60px; display: grid; grid-template-columns: 360px 1fr; gap: 26px; align-items: start; }
@media (max-width: 880px) { .workspace { grid-template-columns: 1fr; } }

.inputs { position: sticky; top: 94px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 880px) { .inputs { position: static; } }
.results { display: flex; flex-direction: column; gap: 18px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card > h3 { color: var(--primary-deep); font-size: 1.08rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card > h3 .n { background: var(--primary); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 0.8rem; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); }
.field select, .field input { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); width: 100%; }
.field select:focus, .field input:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.field--soon label::after { content: " - soon"; color: var(--muted); font-weight: 500; }
.field--soon select { background: var(--surface-alt); color: var(--muted); }


/* Hero value card */
.value-card { background: linear-gradient(135deg, var(--green), #35513d); color: #fff; border: none; }
.value-card h3 { color: #d7ebdb; font-size: 0.9rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.value-card .big { font-size: clamp(2.4rem, 6vw, 3.4rem); font-weight: 900; line-height: 1.05; }
.value-card .big span { font-size: 1rem; font-weight: 700; color: #cfe2cf; }
.value-card .sub2 { color: #d7ebdb; margin-top: 4px; }
.value-card .row { display: flex; gap: 20px; margin-top: 16px; border-top: 1px solid rgba(255,255,255,0.2); padding-top: 14px; flex-wrap: wrap; }
.value-card .row div .k { font-size: 0.74rem; color: #bcd4c1; font-weight: 700; }
.value-card .row div .v { font-size: 1.15rem; font-weight: 800; }

.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pill { background: var(--teal-soft); color: var(--primary-deep); border-radius: 10px; padding: 7px 13px; text-align: right; font-weight: 800; white-space: nowrap; }
.pill .unit { display: block; font-size: 0.7rem; font-weight: 600; color: var(--teal); }

/* CI gauge */
.gauge-track { position: relative; height: 16px; border-radius: 999px; margin: 18px 0 0; background: linear-gradient(90deg, var(--green) 0%, #d8c24a 60%, var(--danger) 100%); }
.gauge-mark { position: absolute; transform: translateX(-50%); }
/* "You" = downward triangle pointer sitting above the bar (distinct shape) */
.gauge-mark.you { top: -13px; width: 0; height: 0;
  border-left: 8px solid transparent; border-right: 8px solid transparent;
  border-top: 12px solid var(--ink); filter: drop-shadow(0 1px 1.5px rgba(255,255,255,0.9)); }
/* avg + baseline = thin vertical line markers through the bar */
.gauge-mark.avg { top: -6px; width: 3px; height: 28px; border-radius: 2px; background: var(--primary);
  box-shadow: 0 0 0 1.5px rgba(255,255,255,0.85); }
.gauge-mark.baseline { top: -5px; width: 3px; height: 26px; border-radius: 2px; background: #fff;
  box-shadow: 0 0 0 1.5px var(--muted); opacity: 0.9; }
.gauge-scale { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--muted); margin-top: 16px; }
.gauge-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 0.82rem; color: var(--ink-soft); }
.gauge-legend span { display: inline-flex; align-items: center; gap: 7px; }
.gauge-legend b { color: var(--ink); }
.gauge-legend i { width: 12px; height: 12px; }
.gauge-legend i.you { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 10px solid var(--ink); }
.gauge-legend i.avg { width: 4px; height: 14px; border-radius: 2px; background: var(--primary); }
.gauge-legend i.baseline { width: 4px; height: 14px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1.5px var(--muted); }

/* Waterfall (practice contribution) */
.wf { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.wf-row { display: grid; grid-template-columns: 130px 1fr 70px; align-items: center; gap: 10px; font-size: 0.86rem; }
.wf-row .name { color: var(--ink-soft); font-weight: 700; }
.wf-bar { height: 14px; background: var(--surface-alt); border-radius: 6px; position: relative; overflow: hidden; }
.wf-bar i { position: absolute; top: 0; height: 100%; border-radius: 6px; }
.wf-row .amt { text-align: right; font-weight: 800; }
.good { color: var(--green); } .bad { color: var(--danger); }

/* Opportunity compare */
.opp { border: 1px dashed var(--teal); background: var(--teal-soft); }
.opp h3 { color: var(--primary-deep); }
.opp .compare { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; text-align: center; }
.opp .compare .k { font-size: 0.74rem; font-weight: 700; color: var(--ink-soft); }
.opp .compare .v { font-size: 1.5rem; font-weight: 900; color: var(--primary-deep); }
.opp .arrow { font-size: 1.4rem; color: var(--teal); }
.opp .gain { margin-top: 12px; text-align: center; font-weight: 800; color: var(--green); }

details.detail { border-top: 1px solid var(--line); padding-top: 10px; }
details.detail summary { cursor: pointer; font-weight: 700; color: var(--primary); }
.metric-row { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding: 10px 0 0; margin-top: 10px; }
.metric-row .label { color: var(--ink-soft); font-weight: 700; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; margin-top: 10px; font-size: 0.8rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); }
.legend i { width: 11px; height: 11px; border-radius: 3px; }
.viz { width: 100%; height: auto; }
.notice { background: var(--surface-alt); border-radius: 10px; padding: 12px 14px; color: var(--ink-soft); font-size: 0.85rem; }
.disclaimer { max-width: 1160px; margin: 0 auto 44px; padding: 0 20px; color: var(--muted); font-size: 0.8rem; text-align: center; }
