/* Refinance closing costs calculator — page-specific styles (v20260920a) */

/* KPI row of three */
.kpi-row-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-row-3 .kpi-value { font-size: 1.05rem; }

/* Field wrapper with slider */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-hint { font-weight: 400; color: var(--ink-500); font-size: 0.8rem; }

/* Range sliders */
input[type=range].cc-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; margin: 2px 0 0; padding: 0;
  background: transparent; cursor: pointer;
}
input[type=range].cc-range:focus { outline: none; }
input[type=range].cc-range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px; background: var(--border);
}
input[type=range].cc-range::-moz-range-track {
  height: 4px; border-radius: 2px; background: var(--border);
}
input[type=range].cc-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
input[type=range].cc-range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
input[type=range].cc-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }
input[type=range].cc-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }

/* LTV line */
.cc-ltv.is-warn { color: #92400e; }
.cc-ltv.is-warn::before { content: "\26A0\FE0E  "; }

/* Tooltips */
.tip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 6px; padding: 0; vertical-align: middle;
  border: 1px solid var(--ink-300); border-radius: 50%; background: transparent;
  color: var(--ink-500); font: 600 10px/1 var(--font-body); cursor: help;
}
.tip:hover, .tip:focus-visible, .tip.is-open { border-color: var(--accent); color: var(--accent-text); outline: none; }
.tip-text {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 20;
  width: 260px; padding: 10px 12px; border-radius: 8px;
  background: var(--ink-900); color: #fff; font: 400 0.8rem/1.45 var(--font-body);
  text-align: left; box-shadow: 0 6px 20px rgba(0,0,0,.2);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.tip-text::after {
  content: ""; position: absolute; left: 4px; top: 100%;
  border: 6px solid transparent; border-top-color: var(--ink-900);
}
.tip:hover .tip-text, .tip:focus-visible .tip-text, .tip.is-open .tip-text {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.itemized .item-name { display: flex; align-items: center; flex-wrap: wrap; }
.itemized-hint { font-size: 0.85rem; color: var(--ink-600); margin: 0 0 12px; }
.itemized-prepaid .item-default { display: none; }

/* Sticky summary (mobile only) */
.cc-sticky { display: none; }
@media (max-width: 1024px) {
  .cc-sticky {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 40;
    margin: 0 0 16px; padding: 10px 14px;
    background: var(--ink-900); color: #fff; border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
  }
  .cc-sticky-label { font-size: 0.8rem; opacity: .8; }
  .cc-sticky-figure strong { font-size: 1.15rem; font-family: var(--font-display); }
  .cc-sticky-figure span { font-size: 0.8rem; opacity: .8; margin-left: 4px; }
}

/* Chart */
.cc-chart-wrap { margin: 16px 0 4px; }
.cc-chart { display: block; width: 100%; height: 22px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.cc-seg-lender { fill: var(--accent); }
.cc-seg-third { fill: var(--ink-500); }
.cc-seg-gov { fill: var(--warning); }
.cc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 0.8rem; color: var(--ink-600); }
.cc-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cc-legend strong { color: var(--ink-900); font-weight: 600; }
.cc-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cc-dot-lender { background: var(--accent); }
.cc-dot-third { background: var(--ink-500); }
.cc-dot-gov { background: var(--warning); }

/* Small notes inside results */
.cc-small-note { font-size: 0.8rem; color: var(--ink-600); line-height: 1.45; margin: 10px 0 0; }
.cc-verdict { font-size: 0.9rem; margin: 12px 0 0; }

/* Three-way comparison tables */
.pay-compare { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 8px; }
.pay-compare th, .pay-compare td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.pay-compare th:first-child, .pay-compare td:first-child { text-align: left; }
.pay-compare thead th { font-weight: 600; font-size: 0.75rem; color: var(--ink-600); }
.pay-compare tbody tr:last-child td { border-bottom: 0; }
.pay-compare .pay-sub { display: block; font-size: 0.72rem; color: var(--ink-500); font-weight: 400; }
.pay-compare td.cc-best { color: var(--positive); font-weight: 600; }
.pay-time th, .pay-time td { padding: 7px 4px; }
.cc-time { margin-top: 20px; }
.pay-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
  /* Edge shadows appear only when there is more table to scroll */
  background-image:
    linear-gradient(to right, var(--paper, #fff) 30%, transparent),
    linear-gradient(to left, var(--paper, #fff) 30%, transparent),
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.18), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.18), transparent);
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
}
.pay-wrap .pay-compare { margin-top: 0; }
@media (max-width: 480px) {
  .pay-compare { font-size: 0.78rem; }
  .pay-compare th, .pay-compare td { padding: 7px 4px; }
  .pay-compare thead th { font-size: 0.68rem; }
  .pay-compare .pay-sub { font-size: 0.66rem; }
  .pay-time th, .pay-time td { padding: 6px 3px; }
  /* Keep the label column at least 58px wide so labels wrap into two lines, not four */
  .pay-time th:first-child::after { content: ""; display: block; width: 58px; height: 0; }
}

/* Typical costs table */
.cc-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.cc-table th, .cc-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; }
.cc-table th:first-child, .cc-table td:first-child { text-align: left; }
.cc-table thead th { font-size: 0.8rem; color: var(--ink-600); font-weight: 600; background: var(--surface-2); }
.cc-table td:last-child { font-weight: 600; color: var(--accent-text); }
.table-wrap { overflow-x: auto; margin: 16px 0; }
.cc-how ol li { margin-bottom: 10px; }

/* Print */
@media print {
  .cc-sticky, .share-actions, .section-faq, .section-related, .section-final-cta,
  .cc-typical, .cc-how, #methodology, .sources-strip, input[type=range], .tip { display: none !important; }
  .cc-chart-wrap, .cc-small-note, .itemized-hint, .defaults-note, .toggle-row { display: none !important; }
  .itemized .item-input { display: none !important; }
  .hero-simple .lede { display: none !important; }
  .collapse-body[hidden] { display: block !important; }
  .cc-chart { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cc-seg-lender, .cc-dot-lender { fill: #3377ff; background: #3377ff; }
  .cc-seg-third, .cc-dot-third { fill: #595959; background: #595959; }
  .cc-seg-gov, .cc-dot-gov { fill: #f59e0b; background: #f59e0b; }
  /* The results card is taller than a page: let it break, keep its blocks whole */
  .results-card { page-break-inside: auto !important; break-inside: auto !important; }
  .results-card .kpi-row-3, .results-card .itemized, .results-card .cc-cash, .pay-compare, .cc-time, .cc-verdict { break-inside: avoid; page-break-inside: avoid; }
  .pay-wrap { overflow: visible; background-image: none; }
  .calc-grid { gap: 12px !important; }
  .form-section:has(#cc-prepaid) { display: none !important; }
}

/* Share row: buttons side by side, help text below */
.share-actions { flex-direction: row; flex-wrap: wrap; }
.share-actions .share-btn { flex: 1 1 140px; }
.share-actions .share-help { flex-basis: 100%; }
