/* FinanceTools — single shared stylesheet (mobile-first) */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0e7490;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}

a { color: var(--primary-dark); }
a:hover { text-decoration: none; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 60px;
}
.brand {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand img { width: 26px; height: 26px; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}
.site-nav a:hover { background: #eff6ff; color: var(--primary-dark); }
.site-nav a.active { background: #eff6ff; color: var(--primary-dark); }

/* Footer */
.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer .footer-links { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary-dark); text-decoration: underline; }
.site-footer .copyright { margin: 0; }

/* Hero (home) */
.hero { padding: 48px 0 24px; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 12px; line-height: 1.2; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 700px; margin: 0 auto 20px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
  cursor: pointer;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--primary-dark); }
.btn-secondary:hover { background: #eff6ff; }

/* Sections & cards */
section { margin-bottom: 32px; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.2rem); line-height: 1.2; margin: 0 0 16px; }
h2 { font-size: 1.3rem; margin: 0 0 12px; }

.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card-grid h2 { grid-column: 1 / -1; margin: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  display: block;
}
.card h3 { margin: 0 0 8px; font-size: 1.05rem; color: var(--primary-dark); }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.card:hover { border-color: var(--primary); }

.content-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.content-section p { margin: 0 0 12px; }
.content-section ul, .content-section ol { padding-left: 20px; }
.muted { color: var(--muted); }

/* Breadcrumbs */
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 16px; font-size: 0.85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary-dark); }

/* Calculator form */
.calc-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field .hint { font-weight: 400; color: var(--muted); }
.field input, .field select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  width: 100%;
}
.field input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.calc-form .actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }

/* Results */
.calc-results { margin-top: 20px; }
.result-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 20px; }
.result-card {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 14px 16px;
}
.result-card .result-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.result-card .result-value { font-size: 1.35rem; font-weight: 800; color: var(--primary-dark); }
.result-card .result-sub { font-size: 0.85rem; color: var(--muted); }

/* Amortization table */
.table-wrap { overflow-x: auto; max-height: 480px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
table.schedule { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.schedule th, table.schedule td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.schedule th { position: sticky; top: 0; background: #f1f5f9; font-weight: 600; }
table.schedule td:first-child, table.schedule th:first-child { text-align: left; }
table.schedule tr:last-child td { border-bottom: none; font-weight: 700; }

/* FAQ */
.faq details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--surface);
  margin-bottom: 10px;
}
.faq summary { cursor: pointer; font-weight: 600; }
.faq summary:hover { color: var(--primary-dark); }
.faq p { margin: 10px 0 0; }

/* Formula */
.formula {
  background: #f1f5f9;
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  overflow-x: auto;
}

/* Related */
.related { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.related ul { margin: 0; padding-left: 20px; }
.related li { margin-bottom: 6px; }

/* Ad slots */
.ad-slot { display: block; margin: 24px 0; min-height: 60px; }
.ad-slot .ad-note { font-size: 0.8rem; color: var(--muted); }

/* Note banner */
.note { font-size: 0.9rem; color: var(--muted); }

/* Print: hide nav/ad, let schedule print cleanly */
@media print {
  .site-header, .site-footer, .calc-form .actions, .ad-slot, .related, .breadcrumbs { display: none; }
  .table-wrap { max-height: none; overflow: visible; }
}
