/* =========================================================
   Mortgage Payment Calculator — tool page styles
   Uses site design tokens from style.css
   ========================================================= */

.calc {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calc__form {
  background: var(--surface);
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.calc__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 20px;
}

.calc__field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.calc__field label em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}

.calc__input-wrap {
  display: flex;
  align-items: stretch;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.calc__input-wrap:focus-within {
  border-color: var(--accent-blue);
}

.calc__input-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  -moz-appearance: textfield;
  appearance: textfield;
}

.calc__input-wrap input::-webkit-outer-spin-button,
.calc__input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calc__input-wrap input:focus { outline: none; }

.calc__prefix,
.calc__suffix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 14px;
  color: var(--muted);
  background: var(--surface);
  white-space: nowrap;
}

.calc__prefix { border-right: 1px solid var(--border); }
.calc__suffix { border-left: 1px solid var(--border); }

.calc__chips {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.calc__chips button {
  border: 1px solid var(--border);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 3px 10px;
  font-size: 12px;
  color: var(--ink);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.calc__chips button:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.calc__submit {
  margin-top: 22px;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent-blue);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--sans);
  padding: 13px 20px;
  transition: background 0.15s ease;
}

.calc__submit:hover { background: #0b3a63; }

/* ---------- Results ---------- */

.calc__results { padding: 24px; }

.calc__hero {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: stretch;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  background: var(--paper);
}

.calc__hero-main { flex: 1 1 260px; }

.calc__hero-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}

.calc__hero-value {
  display: block;
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}

.calc__hero-sub {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.calc__hero-pi {
  flex: 0 0 auto;
  border-left: 1px solid var(--border);
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.calc__hero-pi-value {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-blue);
}

.calc__breakdown { margin-bottom: 20px; }

.calc__bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 90px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  padding: 5px 0;
}

.calc__bar-row span { color: var(--muted); }
.calc__bar-row b { text-align: right; font-variant-numeric: tabular-nums; }

.calc__bar {
  height: 12px;
  background: var(--surface);
  border-radius: 6px;
  overflow: hidden;
}

.calc__bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--c, var(--accent-blue));
  border-radius: 6px;
  transition: width 0.5s ease;
}

.calc__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.calc__stat {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.calc__stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 3px;
}

.calc__stat span em { font-style: normal; opacity: 0.8; }

/* ---------- Verdict box (affordability / refinance) ---------- */

.calc__verdict {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.calc__verdict b {
  display: block;
  font-family: var(--serif);
  font-size: 17px;
  margin-bottom: 4px;
}

.calc__verdict p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #3c3e44;
}

.calc__stat b {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.calc__chart-block,
.calc__table-block { margin-bottom: 24px; }

.calc__chart-block h2,
.calc__table-block h2 {
  font-family: var(--serif);
  font-size: 20px;
  margin: 0 0 12px;
}

#balanceChart {
  width: 100%;
  height: 240px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
}

.calc__table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.calc__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.calc__table th,
.calc__table td {
  padding: 8px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.calc__table th:first-child,
.calc__table td:first-child { text-align: left; }

.calc__table thead th {
  background: var(--surface);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.calc__table tbody tr:hover { background: var(--surface); }
.calc__table tbody tr:last-child td { border-bottom: 0; }
.calc__table tfoot td { font-weight: 700; background: var(--surface); }

.calc__disclaimer {
  font-size: 12px;
  color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin: 20px 0 0;
}

/* ---------- FAQ ---------- */

.faq { margin-top: 32px; }

.faq h2 {
  font-family: var(--serif);
  font-size: 24px;
  margin: 0 0 16px;
}

.faq__item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--paper);
}

.faq__item summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  position: relative;
  padding-right: 40px;
}

.faq__item summary::-webkit-details-marker { display: none; }

.faq__item summary::after {
  content: '+';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--accent-blue);
  transition: transform 0.15s ease;
}

.faq__item[open] summary::after { transform: translateY(-50%) rotate(45deg); }

.faq__item p {
  margin: 0;
  padding: 0 16px 14px;
  color: #3c3e44;
  font-size: 14.5px;
  line-height: 1.65;
}

/* ---------- Sidebar links widget ---------- */

.widget__links { list-style: none; margin: 0; padding: 0; }

.widget__links li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.4;
}

.widget__links li:last-child { border-bottom: 0; }
.widget__links a { color: var(--accent-blue); }
.widget__links a:hover { text-decoration: underline; }

/* ---------- Tools index cards ---------- */

.toolcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.toolcard {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.toolcard:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 2px 10px rgba(15, 76, 129, 0.08);
}

.toolcard__q {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 8px;
}

.toolcard__q a { color: var(--ink); }
.toolcard__q a:hover { color: var(--accent-blue); text-decoration: none; }

.toolcard p {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #3c3e44;
  flex: 1;
}

.toolcard__link {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-blue);
  text-decoration: none;
}

.toolcard__link:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .calc__grid { grid-template-columns: 1fr; }
  .calc__stats { grid-template-columns: repeat(2, 1fr); }
  .calc__hero-pi {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding: 12px 0 0;
  }
  .calc__hero-value { font-size: 32px; }
  .calc__bar-row { grid-template-columns: 110px 1fr 80px; }
}
