/* Payoff Lab — Canadian mortgage payoff calculator */
:root {
  --bg: #f0efe9;
  --surface: #f7f6f2;
  --ink: #171614;
  --muted: #5e5c56;
  --subtle: #8a877f;
  --border: #e4e1d8;
  --accent: #16332e;
  --accent-hover: #0f2420;
  --accent-soft: rgba(22, 51, 46, 0.1);
  --save: #1b6b45;
  --result-bg: #16332e;
  --result-ink: #f7f6f2;
  --result-muted: #a8b5b1;
  --warn-bg: #faf6eb;
  --warn-border: #e4d9b8;
  --warn-ink: #5c4a1f;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-ink: #9b2c2c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 22, 20, 0.06), 0 10px 28px rgba(23, 22, 20, 0.08);
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  width: min(920px, 100% - 2rem);
  margin-inline: auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand-name {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}

.brand-tag {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}

.hero {
  padding: 2rem 0 0.35rem;
  text-align: center;
}

.hero h1 {
  margin: 0 0 0.6rem;
  font-family: var(--display);
  font-size: clamp(1.65rem, 4.5vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero p {
  margin: 0 auto;
  color: var(--muted);
  max-width: 34rem;
  font-size: 1.05rem;
}

.how-to {
  max-width: 36rem;
  margin: 1.15rem auto 0;
  text-align: center;
}

.how-to h2 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.how-to p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.calc-grid {
  display: grid;
  gap: 1.5rem;
  padding: 1.5rem 0 1.75rem;
}

@media (min-width: 800px) {
  .calc-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 2rem;
  }

  .results-card {
    position: sticky;
    top: 1.25rem;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem;
}

.card h2 {
  margin: 0 0 1.1rem;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.field {
  margin-bottom: 1rem;
}

.field:last-of-type {
  margin-bottom: 1.35rem;
}

.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.field .hint {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--subtle);
  margin-top: 0.3rem;
}

.field input,
.field select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-prefix,
.input-suffix {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.85rem 1rem;
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.05s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-ghost {
  background: #ebe8e0;
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: not-allowed;
  opacity: 0.9;
}

.note {
  margin: 0.85rem 0 0;
  font-size: 0.8rem;
  color: var(--subtle);
}

.results-card {
  background: var(--result-bg);
  color: var(--result-ink);
  border-color: transparent;
}

.results-card h2 {
  color: var(--result-ink);
}

.metrics {
  display: grid;
  gap: 0.75rem;
}

.metric {
  padding: 0.8rem 0.9rem;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 10px;
}

.metric-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--result-muted);
  margin-bottom: 0.2rem;
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metric-sub {
  display: block;
  font-size: 0.8rem;
  color: var(--result-muted);
  margin-top: 0.2rem;
}

.savings {
  margin-top: 1rem;
  padding: 0.95rem;
  background: rgba(27, 107, 69, 0.28);
  border: 1px solid rgba(27, 107, 69, 0.4);
  border-radius: 10px;
}

.savings h3 {
  margin: 0 0 0.7rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #b7e0c8;
}

.savings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.savings .metric-value {
  font-size: 1.15rem;
}

.results-placeholder {
  margin: 0;
  color: var(--result-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.error-banner {
  display: none;
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: 10px;
  color: var(--error-ink);
  font-size: 0.875rem;
}

.error-banner.visible {
  display: block;
}

.ratehub-cta {
  margin: 0 0 1.5rem;
  text-align: center;
}

.ratehub-cta h2 {
  margin: 0 0 0.5rem;
}

.ratehub-cta p {
  margin: 0 auto 1rem;
  max-width: 36rem;
  color: var(--muted);
  font-size: 0.925rem;
}

.ratehub-cta .btn-ratehub {
  display: inline-flex;
  width: auto;
  min-width: min(100%, 22rem);
  background: var(--accent);
  color: #fff;
}

.ratehub-cta .btn-ratehub:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.ratehub-cta .btn-ratehub:active {
  transform: translateY(1px);
}

.ratehub-cta .note {
  margin: 0.85rem auto 0;
  max-width: 34rem;
  color: var(--subtle);
}

.disclaimer {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1.1rem;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 10px;
  color: var(--warn-ink);
  font-size: 0.875rem;
  text-align: center;
}

.cta {
  margin-bottom: 2rem;
  text-align: center;
}

.cta p {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.925rem;
}

.cta-list {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  color: var(--ink);
  font-size: 0.95rem;
}

.cta-list li {
  position: relative;
  padding: 0.28rem 0 0.28rem 1.45rem;
}

.cta-list li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.58rem;
  width: 0.7rem;
  height: 0.7rem;
  border: 1.5px solid var(--accent);
  border-radius: 3px;
  box-sizing: border-box;
}

.cta-list li::after {
  content: "";
  position: absolute;
  left: 0.36rem;
  top: 0.72rem;
  width: 0.28rem;
  height: 0.16rem;
  border-left: 1.6px solid var(--accent);
  border-bottom: 1.6px solid var(--accent);
  transform: rotate(-45deg);
}

.cta-price {
  margin: 0 0 0.95rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
}

.cta-price-note {
  display: inline-block;
  margin-left: 0.2rem;
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--subtle);
}

.btn-cta {
  background: var(--accent);
  color: #fff;
}

.btn-cta:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-cta:active {
  transform: translateY(1px);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0 2rem;
  font-size: 0.8rem;
  color: var(--subtle);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  color: var(--subtle);
}

.footer-links a:hover {
  color: var(--accent);
}

.prose {
  padding: 1.75rem 0 2.5rem;
  max-width: 40rem;
}

.prose h1 {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.prose p,
.prose li {
  color: var(--muted);
}

.prose ul {
  padding-left: 1.25rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* —— Fun money (Amazon.ca) —— */
.fun-money {
  margin: 0 0 2rem;
  padding: 0;
}

.fun-money-header {
  text-align: center;
  margin-bottom: 1.1rem;
}

.amazon-badge {
  display: inline-block;
  width: min(140px, 42vw);
  height: auto;
  margin: 0 0 0.85rem;
  border-radius: 6px;
}

.fun-money-header h2 {
  margin: 0 0 0.65rem;
  font-family: var(--display);
  font-size: clamp(1.25rem, 3.5vw, 1.55rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ink);
}

.fun-money-lead {
  margin: 0 auto 0.85rem;
  max-width: 38rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.affiliate-disclosure {
  margin: 0 auto;
  max-width: 36rem;
  padding: 0.7rem 0.95rem;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 10px;
  color: var(--warn-ink);
  font-size: 0.8rem;
  line-height: 1.45;
}

.fun-money-filter-note {
  margin: 0 auto 1.25rem;
  max-width: 40rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--subtle);
  line-height: 1.45;
}

.fun-groups {
  display: grid;
  gap: 1.15rem;
}

@media (min-width: 900px) {
  .fun-groups {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }
}

.fun-group {
  margin: 0;
  padding: 1.15rem 1.2rem 1.15rem;
}

.fun-group h3 {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--accent);
}

.product-grid {
  display: grid;
  gap: 0.9rem;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0.85rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.product-card-image-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #f7f8f7;
  border-radius: 10px;
  text-decoration: none;
  overflow: hidden;
}

.product-card-image {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  margin: 0 auto;
  padding: 0.5rem;
}

.product-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
}

.product-card-name {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.product-card-rating {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: #b45309;
  line-height: 1.35;
}

.product-card-price {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
}

.product-card-price-note {
  font-weight: 500;
  color: var(--subtle);
  font-size: 0.78rem;
}

.product-card-blurb {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  flex: 1;
}

.btn-amazon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
}

.btn-amazon:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-amazon:active {
  transform: translateY(1px);
}

.fun-money-foot {
  margin: 1.25rem auto 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--subtle);
  max-width: 36rem;
  line-height: 1.45;
}

/* Tablet+: image left, content right */
@media (min-width: 520px) {
  .product-card {
    flex-direction: row;
    align-items: stretch;
    gap: 1rem;
  }

  .product-card-image-link {
    width: 140px;
    min-height: 140px;
    align-self: flex-start;
  }

  .product-card-image {
    max-width: 140px;
    max-height: 140px;
    padding: 0.4rem;
  }

  .btn-amazon {
    width: auto;
    align-self: flex-start;
    white-space: nowrap;
  }
}

@media (min-width: 700px) {
  .product-card-image-link {
    width: 160px;
    min-height: 160px;
  }

  .product-card-image {
    max-width: 160px;
    max-height: 160px;
  }
}
