/* Debt payoff calculator. Loads after calculator.css and modern.css and
   reuses their tokens; only page-specific layout and the chart live here. */

.debt-body { --debt-card-line: #181a18; --debt-loan-line: #5d7058; }
.debt-print-brand, .debt-print-inputs, .debt-print-invalid { display: none; }

.debt-switcher { flex-wrap: wrap; }
.debt-switcher a { display: inline-flex; min-height: 44px; align-items: center; }

.debt-workbench { grid-template-columns: minmax(0,.92fr) minmax(0,1.08fr); padding-bottom: 32px; }
.debt-results { position: static; }
.debt-illustrative { margin: -12px 0 24px; padding: 10px 14px; color: var(--modern-gray); border-left: 3px solid var(--modern-sage); background: #f6f7f3; font-size: 14px; line-height: 1.55; }

.debt-group { min-width: 0; margin: 0 0 28px; padding: 0; border: 0; }
.debt-group + .debt-group { padding-top: 26px; border-top: 1px solid var(--modern-rule); }
.debt-group > legend { padding: 0; margin-bottom: 16px; color: var(--modern-charcoal); font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.debt-field { min-width: 0; margin-bottom: 18px; }
.debt-label { display: block; margin-bottom: 7px; color: var(--modern-charcoal); font-size: 15px; font-weight: 750; }
.debt-label em { margin-left: 5px; color: var(--modern-gray); font-size: 11px; font-style: normal; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.debt-field small { display: block; margin-top: 4px; color: var(--modern-gray); font-size: 14px; line-height: 1.55; }
.debt-field small.is-error { color: var(--modern-error); font-weight: 700; }
.debt-field .input-shell { height: 50px; }
.debt-field .input-shell:has(input[aria-invalid="true"]) { border-color: var(--modern-error); box-shadow: 0 0 0 3px var(--modern-error-bg); }

.debt-range { display: block; width: 100%; height: 44px; margin: 2px 0 0; background: transparent; cursor: pointer; accent-color: var(--modern-charcoal); -webkit-appearance: none; appearance: none; }
.debt-range::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: var(--modern-rule); }
.debt-range::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -10px; border: 3px solid white; border-radius: 50%; background: var(--modern-charcoal); box-shadow: 0 1px 4px rgba(24,26,24,.35); -webkit-appearance: none; appearance: none; }
.debt-range::-moz-range-track { height: 4px; border-radius: 999px; background: var(--modern-rule); }
.debt-range::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--modern-sage); }
.debt-range::-moz-range-thumb { width: 18px; height: 18px; border: 3px solid white; border-radius: 50%; background: var(--modern-charcoal); box-shadow: 0 1px 4px rgba(24,26,24,.35); }
body.modern-site .debt-range:focus-visible { outline: 3px solid var(--modern-charcoal); outline-offset: 2px; box-shadow: none; }

.debt-mode { margin: 4px 0 18px; }
.debt-mode .segmented-options span { min-height: 48px; }
.debt-mode-help { margin: 10px 0 0; color: var(--modern-gray); font-size: 14px; line-height: 1.55; }

.debt-loading { padding: 18px; color: var(--modern-gray); border: 1px dashed var(--modern-control); border-radius: 10px; background: white; font-size: 15px; }
.debt-loading p { margin: 0; }
.debt-loading p + p { margin-top: 10px; }
.debt-errors { margin-top: 0; }
.debt-errors p { margin: 0 0 6px; font-weight: 700; }

.debt-deltas { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; background: var(--modern-rule); border: 1px solid var(--modern-rule); border-radius: 12px; overflow: hidden; }
.debt-delta { min-width: 0; padding: 16px; background: white; }
.debt-delta span, .debt-delta strong, .debt-delta small { display: block; }
.debt-delta span { color: var(--modern-gray); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.debt-delta strong { margin-top: 6px; color: var(--modern-charcoal); font-size: clamp(1.25rem, 2.2vw, 1.65rem); font-weight: 650; line-height: 1.15; letter-spacing: -.03em; overflow-wrap: anywhere; }
.debt-delta strong.is-unavailable { color: var(--modern-error); }
.debt-delta small { margin-top: 6px; color: var(--modern-gray); font-size: 13px; line-height: 1.5; }
.debt-warning { margin-top: 16px; }
.debt-warning strong { display: block; margin-bottom: 4px; }

.debt-results-body { container-type: inline-size; }
.debt-columns { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 18px; }
.debt-column { min-width: 0; padding: 16px; border: 1px solid var(--modern-rule); border-radius: 12px; background: white; }
.debt-column-card { border-top: 4px solid var(--debt-card-line); }
.debt-column-loan { border-top: 4px solid var(--debt-loan-line); }
.debt-column h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 16px; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; }
.debt-swatch { flex: 0 0 auto; width: 18px; height: 0; border-top: 3px solid var(--debt-card-line); }
.debt-swatch-loan { border-top: 3px dashed var(--debt-loan-line); }
.debt-column dl { margin: 0; }
.debt-column dl > div { padding: 10px 0; border-bottom: 1px solid var(--modern-rule); }
.debt-column dl > div:last-child { border-bottom: 0; }
.debt-column dt { color: var(--modern-gray); font-size: 13px; line-height: 1.4; }
.debt-column dd { margin: 3px 0 0; color: var(--modern-charcoal); font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.debt-column dd.is-unavailable { color: var(--modern-error); font-size: 15px; }
.debt-column .debt-total dt { color: var(--modern-charcoal); font-weight: 700; }
.debt-column .debt-total dd { font-size: 19px; }

.debt-interest-line, .debt-mode-note { margin: 16px 0 0; color: var(--modern-charcoal); font-size: 14px; line-height: 1.6; }
.debt-mode-note { padding: 12px 14px; border-left: 3px solid var(--modern-sage); background: #f6f7f3; }
.debt-secured-note { margin-top: 16px; padding: 12px 14px; color: var(--modern-charcoal); border: 1px solid var(--modern-control); border-radius: 10px; background: white; font-size: 14px; line-height: 1.6; }
.debt-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 22px; }
.debt-actions .button { width: 100%; min-height: 50px; padding-inline: 14px; }
.debt-actions .button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.debt-chart-section { margin-bottom: 90px; padding: 30px; }
.debt-chart-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 30px; }
.debt-chart-heading h2 { margin: 3px 0 0; font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 600; line-height: 1.1; letter-spacing: -.04em; }
.debt-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; list-style: none; font-size: 14px; font-weight: 700; }
.debt-legend li { display: flex; align-items: center; gap: 8px; }
.debt-legend-line { width: 28px; height: 0; border-top: 3px solid var(--debt-card-line); }
.debt-legend-loan { border-top: 3px dashed var(--debt-loan-line); }
.debt-chart { width: 100%; min-height: 240px; margin-top: 20px; }
.debt-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.debt-chart .axis-text { fill: #676d66; font-family: var(--sans); font-size: 12px; }
.debt-chart .axis-title { fill: #181a18; font-family: var(--sans); font-size: 12px; font-weight: 700; }
.debt-chart .grid-line { stroke: #e3e6df; stroke-width: 1; }
.debt-chart .axis-line { stroke: #949c90; stroke-width: 1; }
.debt-chart .line-card { fill: none; stroke: var(--debt-card-line); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.debt-chart .line-loan { fill: none; stroke: var(--debt-loan-line); stroke-width: 3; stroke-dasharray: 9 6; stroke-linejoin: round; stroke-linecap: round; }
.debt-chart .marker-card { fill: var(--debt-card-line); }
.debt-chart .marker-loan { fill: white; stroke: var(--debt-loan-line); stroke-width: 3; }
.debt-chart-summary { max-width: 860px; margin: 16px 0 0; color: var(--modern-gray); font-size: 15px; line-height: 1.6; }
.debt-year-details { margin-top: 20px; }
.debt-year-table { min-width: 420px; }
.debt-year-table td.is-muted { color: var(--modern-gray); }

.debt-explainer-lede { max-width: 560px; margin: 22px 0 0; color: var(--modern-gray); font-size: 16px; line-height: 1.7; }
.debt-explainer .explainer-list a { color: var(--modern-charcoal); text-decoration: underline; text-underline-offset: 3px; }

.debt-review { padding: 90px 0; background: white; border-top: 1px solid var(--modern-rule); }
.debt-review-grid { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 60px; align-items: start; }
.debt-review h2 { margin: 0; font-size: clamp(2.2rem, 4vw, 3.6rem); font-weight: 550; line-height: 1.05; letter-spacing: -.045em; }
.debt-review p { margin: 0 0 14px; color: var(--modern-gray); font-size: 16px; line-height: 1.75; }
.debt-review-privacy { padding-left: 14px; border-left: 3px solid var(--modern-sage); }
.debt-review-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

@container (min-width: 440px) {
  .debt-columns { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 980px) {
  .debt-workbench { grid-template-columns: 1fr; }
  .debt-review-grid { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 650px) {
  .debt-switcher { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .debt-switcher a { justify-content: center; }
  .debt-illustrative { margin-top: -8px; }
  .debt-deltas { grid-template-columns: 1fr; }
  .debt-actions { grid-template-columns: 1fr; }
  .debt-chart-section { margin-bottom: 60px; padding: 22px 16px; }
  .debt-review { padding: 64px 0; }
  .debt-review-actions .button { width: 100%; }
}
@media (max-width: 360px) {
  .debt-results .panel-heading { display: block; }
  .debt-column { padding: 14px 12px; }
  .debt-chart .axis-text { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .debt-range::-webkit-slider-thumb { transition: none; }
}

@media print {
  @page { margin: 14mm; }
  body.modern-site.debt-body { padding: 0 !important; background: white; color: black; font-size: 11pt; }
  .debt-body :is(.site-header, .skip-link, .calculator-switcher, .debt-inputs, .debt-actions, .debt-review, .mobile-action-bar, .footer-main, .calculator-intro .calculator-privacy, .debt-loading, .debt-year-details:not([open]), .debt-explainer .explainer-list p:last-child) { display: none !important; }
  .debt-body .debt-print-brand { display: block; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid #181a18; }
  .debt-print-brand strong, .debt-print-brand > span { display: block; }
  .debt-print-brand strong { font-size: 14pt; }
  .debt-print-brand > span { color: #444; font-size: 9pt; }
  .debt-body .calculator-intro { padding: 0 0 8px; border: 0; }
  .debt-body .calculator-intro h1 { font-size: 20pt; }
  .debt-body .calculator-intro p:not(.eyebrow) { margin-top: 6px; font-size: 10pt; }
  .debt-body .calculator-intro .eyebrow { display: none; }
  .debt-body .shell { width: 100%; }
  .debt-body .debt-workbench { display: block; padding: 0; }
  .debt-body :is(.calculator-panel, .debt-column, .debt-deltas) { box-shadow: none !important; }
  .debt-body .debt-results { padding: 0; border: 0; background: white; }
  .debt-body .debt-columns { grid-template-columns: 1fr 1fr; }
  .debt-body .debt-print-inputs { display: block; margin: 0 0 12px; break-inside: avoid; }
  .debt-print-inputs h2 { margin: 0 0 6px; font-size: 12pt; }
  .debt-print-inputs dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 2px 18px; margin: 0; font-size: 10pt; }
  .debt-print-inputs dl > div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #ccc; }
  .debt-print-inputs dd { margin: 0; font-weight: 700; }
  .debt-body .debt-chart-section { margin: 12px 0; padding: 0; border: 0; break-inside: avoid; }
  .debt-body .debt-explainer { padding: 10px 0 0; break-inside: avoid; }
  .debt-body .debt-explainer .calculator-explainer-grid { display: block; }
  .debt-body .debt-explainer h2 { font-size: 13pt; }
  .debt-body .explainer-list p { grid-template-columns: 150px 1fr; padding: 4px 0; font-size: 9pt; }
  .debt-body .explainer-list :is(strong, span) { font-size: 9pt; }
  .debt-body .site-footer { padding: 8px 0 0; color: #333; background: white; }
  .debt-body .footer-legal { padding: 0; color: #333; border: 0; font-size: 8pt; line-height: 1.5; }
  .debt-body .footer-legal a { color: #333; }
  .debt-body .footer-legal p:last-child { display: none; }
  body.debt-is-invalid :is(.debt-results-body, .debt-chart-section, .debt-print-inputs) { display: none !important; }
  body.debt-is-invalid .debt-print-invalid { display: block; padding: 10px; border: 1px solid #9b3028; }
}
