/* Website cost calculator: only what styles.css doesn't already have. */

.cost-calc { display: grid; gap: var(--space-l); margin-top: var(--space-l); }
@media (min-width: 56em) { .cost-calc { grid-template-columns: 19rem 1fr; gap: var(--space-xl); align-items: start; } }

/* Controls */
.cost-form { display: grid; gap: var(--space-m); padding: var(--space-m); background: #fff; border: 1px solid var(--color-line); border-radius: var(--radius); }
@media (min-width: 56em) { .cost-form { position: sticky; top: var(--space-m); } }
.cost-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.cost-form legend, .cost-label { display: block; padding: 0; margin-bottom: var(--space-2xs); font-size: var(--text-small); font-weight: 700; }
.cost-years { display: flex; align-items: center; gap: var(--space-s); }
.cost-years output { flex: none; min-width: 4.5rem; font-family: var(--font-heading); font-size: 1.75rem; line-height: 1; }
.cost-years input[type="range"] { flex: 1; min-width: 0; accent-color: var(--color-accent); height: 2rem; }
.cost-form .choices .choice { min-height: 2.5rem; padding-inline: 0.9rem; font-size: var(--text-small); }
.cost-form .check { font-size: var(--text-small); }
.cost-form .check small { display: block; color: var(--color-text-muted); }
.cost-current { display: flex; align-items: center; gap: var(--space-2xs); }
.cost-current input {
  width: 8rem; min-height: 2.75rem; padding: 0.5rem 0.75rem;
  font: inherit; color: var(--color-text); background: #fff;
  border: 1px solid #c9c5bc; border-radius: var(--radius);
}
.cost-current input:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 1px; border-color: var(--color-accent); }
.cost-current span { font-size: var(--text-small); color: var(--color-text-muted); }

/* Results */
.cost-results > * + * { margin-top: var(--space-m); }
.cost-results h2 { margin-bottom: 0; }
.cost-rows { list-style: none; padding: 0; display: grid; gap: var(--space-m); }
.cost-row { display: grid; gap: 0.4rem; }
.cost-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 var(--space-s); }
.cost-name { font-weight: 700; }
.cost-tag { font-weight: 400; font-size: var(--text-small); color: var(--color-text-muted); }
.cost-total { font-family: var(--font-heading); font-size: 1.75rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cost-bar { height: 0.75rem; border-radius: 999px; background: var(--color-bg-alt); overflow: hidden; }
.cost-bar span { display: block; height: 100%; border-radius: inherit; background: #c9c5bc; }
@media (prefers-reduced-motion: no-preference) { .cost-bar span { transition: width 0.35s ease-out; } }
.cost-parts { font-size: var(--text-small); color: var(--color-text-muted); }
.cost-row.is-fledge .cost-bar span { background: var(--color-accent); }
.cost-row.is-fledge .cost-total { color: var(--color-accent); }
.cost-row.is-current .cost-bar span { background: var(--color-text); }
.cost-summary { max-width: var(--measure); font-size: var(--text-lead); line-height: 1.5; font-weight: 700; }
.cost-summary:empty { display: none; }
.cost-results .hand-note { margin-top: var(--space-2xs); }

/* What you get for the money: three cards */
.section > .wrap > .cost-kinds { margin-top: var(--space-l); }
.cost-kinds { display: grid; gap: var(--space-m); }
@media (min-width: 56em) { .cost-kinds { grid-template-columns: repeat(3, 1fr); } }
.cost-kind { padding: var(--space-m); background: #fff; border: 1px solid var(--color-line); border-radius: var(--radius); }
.cost-kind > * + * { margin-top: var(--space-2xs); }
.cost-kind.is-fledge { border-color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.cost-kind .ticks, .cost-kind .crosses { gap: var(--space-2xs); margin-top: var(--space-s); font-size: var(--text-small); }

/* How I counted: the sources */
.section > .wrap > .cost-sources { margin-top: var(--space-l); }
.cost-sources { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
.cost-sources th, .cost-sources td { padding: var(--space-2xs) var(--space-s) var(--space-2xs) 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--color-line); }
.cost-sources th { font-weight: 700; }
.cost-sources td:last-child, .cost-sources th:last-child { padding-right: 0; }
@media (max-width: 40em) {
  .cost-sources thead { display: none; }
  .cost-sources tr { display: grid; padding-block: var(--space-2xs); border-bottom: 1px solid var(--color-line); }
  .cost-sources td { padding: 0.1rem 0; border: 0; }
  .cost-sources td:first-child { font-weight: 700; }
}
.section > .wrap > .cost-caveats { margin-top: var(--space-m); max-width: var(--measure); }
.cost-caveats { padding-left: 1.25rem; display: grid; gap: var(--space-2xs); color: var(--color-text-muted); font-size: var(--text-small); }

.cost-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-s); margin-top: var(--space-l); }
