/* ============================================================
   Finance Tools — Shared Stylesheet
   Clean, premium financial design system.
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

:root {
  /* Brand */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;

  /* Semantic accents */
  --emerald-50:  #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --amber-50:  #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --red-50:  #fef2f2;
  --red-500: #ef4444;

  /* Neutrals */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Surfaces & shadows */
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.07), 0 4px 10px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.08), 0 8px 16px -8px rgba(0,0,0,0.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--slate-700);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Header ---------- */
.site-header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
}

.site-header nav {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.logo {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--slate-800);
  letter-spacing: -0.02em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 0.15s;
}

.logo:hover { opacity: 0.7; }

.logo svg { color: var(--blue-600); flex-shrink: 0; }

/* Nav links */
.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  color: var(--slate-500);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-xs);
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover {
  color: var(--slate-800);
  background: var(--slate-100);
}

/* ---------- Main content container ---------- */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  margin-bottom: 3rem;
  padding: 0 0.5rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--slate-900);
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.hero p {
  color: var(--slate-500);
  font-size: 1.0625rem;
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto;
}

/* Breadcrumb on sub-pages */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--slate-400);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--slate-500);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb a:hover { color: var(--blue-600); }

.breadcrumb .sep { color: var(--slate-300); }

/* ---------- Card ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--slate-200);
  padding: 2rem 2.25rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--slate-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--slate-100);
}

/* Secondary content cards — lighter than the primary calculator card */
.card.section {
  background: var(--slate-50);
  box-shadow: none;
  border-color: var(--slate-100);
}

/* ---------- Tool grid (homepage) ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.125rem;
}

.tool-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
  position: relative;
}

.tool-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--blue-500);
  transform: translateY(-2px);
}

.tool-card .tool-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.875rem;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.tool-card .tool-icon.blue    { background: var(--blue-50); color: var(--blue-600); }
.tool-card .tool-icon.green   { background: var(--emerald-50); color: var(--emerald-600); }
.tool-card .tool-icon.amber   { background: var(--amber-50); color: var(--amber-600); }

.tool-card h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.tool-card p {
  font-size: 0.8125rem;
  color: var(--slate-500);
  flex: 1;
  margin-bottom: 1rem;
  line-height: 1.55;
}

.tool-card .tool-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--blue-600);
  text-decoration: none;
  transition: gap 0.2s;
}

.tool-card .tool-link:hover { gap: 0.55rem; }

.tool-sub-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.5rem;
  padding: 0;
}
.tool-sub-links li a {
  font-size: 0.75rem;
  color: var(--slate-500);
  text-decoration: none;
  transition: color 0.15s;
}
.tool-sub-links li a:hover {
  color: var(--blue-600);
  text-decoration: underline;
}

/* Feature the last card spanning full width when odd count */
.tool-grid .tool-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* ---------- Section heading (homepage) ---------- */
.section-heading {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--slate-400);
  margin-bottom: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Form ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Input wrapper with prefix / suffix support */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap .prefix,
.input-wrap .suffix {
  position: absolute;
  color: var(--slate-400);
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: none;
  user-select: none;
}

.input-wrap .prefix { left: 0.875rem; }
.input-wrap .suffix { right: 0.875rem; }

.input-wrap input,
.input-wrap select {
  width: 100%;
  height: 44px;
  padding: 0 0.875rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-xs);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--slate-800);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

/* Keep native arrow on select */
.input-wrap select {
  appearance: auto;
  -webkit-appearance: auto;
  cursor: pointer;
}

.input-wrap input::placeholder {
  color: var(--slate-300);
  font-weight: 400;
}

.input-wrap input:hover,
.input-wrap select:hover {
  border-color: var(--slate-300);
}

.input-wrap input:focus,
.input-wrap select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.input-wrap.has-prefix input { padding-left: 1.75rem; }
.input-wrap.has-suffix input { padding-right: 2.75rem; }

/* Full-width form group (spans both columns) */
.form-group.full { grid-column: 1 / -1; }

/* ---------- Buttons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 1.25rem;
  height: 48px;
  background: var(--blue-600);
  color: #fff;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(37,99,235,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn:hover {
  background: var(--blue-700);
  box-shadow: 0 3px 12px rgba(37,99,235,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn:active { transform: scale(0.985); }

/* ---------- Results ---------- */
.results {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--slate-100);
}

.results.visible { display: grid; }

.result-item {
  text-align: center;
  padding: 1.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.result-item.blue {
  background: var(--blue-50);
  border-color: var(--blue-100);
}

.result-item.green {
  background: var(--emerald-50);
  border-color: var(--emerald-100);
}

.result-item.amber {
  background: var(--amber-50);
  border-color: var(--amber-100);
}

.result-item .label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.result-item.blue  .label { color: var(--blue-600); }
.result-item.green .label { color: var(--emerald-600); }
.result-item.amber .label { color: var(--amber-600); }

.result-item .value {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

/* Two-column results variant */
.results.cols-2 { grid-template-columns: 1fr 1fr; }

/* Four-item results: displayed as a 2×2 grid */
.results.cols-4 { grid-template-columns: repeat(2, 1fr); }

/* ---------- Chart wrapper ---------- */
.chart-wrap {
  display: none;
  position: relative;
  margin-top: 1.5rem;
  padding: 1.25rem 0.75rem 0.5rem;
  background: var(--slate-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
}

.chart-wrap.visible { display: block; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  text-align: right;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--slate-100);
}

.data-table th {
  background: var(--slate-50);
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-500);
  border-bottom-color: var(--slate-200);
}

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

.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--slate-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .highlight {
  font-weight: 700;
  color: var(--blue-600);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.green { background: var(--emerald-50); color: var(--emerald-500); }
.badge.amber { background: var(--amber-50); color: var(--amber-500); }
.badge.red   { background: var(--red-50); color: var(--red-500); }
.badge.blue  { background: var(--blue-50); color: var(--blue-600); }

/* ---------- Content sections ---------- */
.section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--slate-800);
  letter-spacing: -0.015em;
}

.section p {
  color: var(--slate-600);
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.7;
}

.section ul,
.section ol {
  padding-left: 1.25rem;
  margin-top: 0.5rem;
}

.section li {
  color: var(--slate-600);
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* Formula block */
.formula-block {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-left: 3px solid var(--blue-600);
  border-radius: var(--radius-xs);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 0.875rem;
  color: var(--slate-700);
  overflow-x: auto;
  line-height: 1.8;
}

.formula-block .var-label {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.8125rem;
  color: var(--slate-400);
  display: block;
  margin-top: 0.25rem;
}

/* ---------- FAQ ---------- */
.faq-item {
  border-bottom: 1px solid var(--slate-100);
  padding: 1.125rem 0;
}

.faq-item:last-child { border-bottom: none; }

.faq-item h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--slate-800);
}

.faq-item p {
  color: var(--slate-500);
  font-size: 0.875rem;
  line-height: 1.65;
}

/* ---------- Disclaimer box ---------- */
.disclaimer {
  background: var(--amber-50);
  border: 1px solid var(--amber-100);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
  color: var(--slate-600);
  line-height: 1.6;
}

.disclaimer strong { color: var(--amber-600); }

/* ---------- Error message ---------- */
.error-msg {
  display: none;
  color: var(--red-500);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 0.625rem;
}

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

/* ---------- Homepage: Hero ---------- */
.hp-hero {
  background: linear-gradient(170deg, var(--blue-50) 0%, #fff 65%);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
}

.hp-hero-inner {
  max-width: 640px;
  margin: 0 auto;
}

.hp-badge {
  display: inline-block;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.875rem;
  border-radius: 20px;
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
}

.hp-hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--slate-900);
  line-height: 1.12;
  margin-bottom: 1rem;
}

.hp-hero p {
  color: var(--slate-500);
  font-size: 1.125rem;
  line-height: 1.65;
  max-width: 520px;
  margin: 0 auto 1.75rem;
}

.hp-hero-btn {
  display: inline-flex;
  width: auto;
  padding: 0 2rem;
  margin-top: 0;
}

/* ---------- Homepage: Trust bar ---------- */
.hp-trust-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--slate-200);
  background: #fff;
}

.hp-trust-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--slate-500);
  font-size: 0.8125rem;
  font-weight: 500;
}

.hp-trust-item svg { color: var(--blue-500); flex-shrink: 0; }

/* ---------- Homepage: Featured tool ---------- */
.hp-featured { margin-bottom: 3rem; }

.hp-featured-card {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  background: linear-gradient(135deg, var(--blue-50) 0%, var(--emerald-50) 100%);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius);
  padding: 2.25rem 2.5rem;
}

.hp-featured-content { flex: 1; }

.hp-label {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-600);
  margin-bottom: 0.5rem;
}

.hp-featured-content h2 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 0.5rem;
  letter-spacing: -0.015em;
}

.hp-featured-content p {
  font-size: 0.9375rem;
  color: var(--slate-600);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.hp-featured-btn {
  width: auto;
  display: inline-flex;
  padding: 0 1.5rem;
  margin-top: 0;
  height: 42px;
  font-size: 0.875rem;
}

.hp-featured-visual {
  flex-shrink: 0;
  width: 160px;
}

.hp-mock-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
}

.hp-bar {
  flex: 1;
  background: linear-gradient(to top, var(--blue-500), var(--emerald-500));
  border-radius: 4px 4px 0 0;
  opacity: 0.7;
}

/* ---------- Homepage: Section styles ---------- */
.hp-section {
  margin-top: 3.5rem;
  padding-top: 3rem;
  border-top: 1px solid var(--slate-200);
}

.hp-section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slate-800);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hp-section-subtitle {
  color: var(--slate-500);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

/* Audience grid */
.hp-audience-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.hp-audience-item {
  padding: 1.5rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  transition: box-shadow 0.2s;
}

.hp-audience-item:hover { box-shadow: var(--shadow-md); }

.hp-audience-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.875rem;
}

.hp-audience-icon.blue  { background: var(--blue-50); color: var(--blue-600); }
.hp-audience-icon.green { background: var(--emerald-50); color: var(--emerald-600); }
.hp-audience-icon.amber { background: var(--amber-50); color: var(--amber-600); }

.hp-audience-item h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 0.35rem;
}

.hp-audience-item p {
  font-size: 0.8125rem;
  color: var(--slate-500);
  line-height: 1.55;
}

/* Why grid */
.hp-why-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.hp-why-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  transition: box-shadow 0.2s;
}

.hp-why-item:hover { box-shadow: var(--shadow-md); }

.hp-why-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hp-why-item h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 0.2rem;
}

.hp-why-item p {
  font-size: 0.8125rem;
  color: var(--slate-500);
  line-height: 1.55;
}

/* ---------- Homepage: Footer ---------- */
.hp-footer-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  text-align: left;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--slate-200);
  margin-bottom: 1.25rem;
}

.hp-footer-brand .logo {
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
}

.hp-footer-brand p {
  font-size: 0.8125rem;
  color: var(--slate-400);
  max-width: 280px;
  line-height: 1.5;
}

.hp-footer-links h4 {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
  margin-bottom: 0.75rem;
}

.hp-footer-links ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hp-footer-links a {
  font-size: 0.8125rem;
  color: var(--slate-500);
  text-decoration: none;
  transition: color 0.15s;
}

.hp-footer-links a:hover { color: var(--blue-600); }

.hp-footer-bottom {
  text-align: center;
}

.hp-footer-bottom p {
  font-size: 0.75rem;
  color: var(--slate-400);
}

/* ---------- Related calculators ---------- */
.related-tools {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.related-tools h2 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--slate-400);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.related-tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}

.related-tools-grid a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xs);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--slate-700);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.2s;
}

.related-tools-grid a:hover {
  border-color: var(--blue-500);
  box-shadow: var(--shadow-sm);
  color: var(--blue-600);
  transform: translateY(-1px);
}

.related-tools-grid .rt-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rt-icon.blue  { background: var(--blue-50); color: var(--blue-600); }
.rt-icon.green { background: var(--emerald-50); color: var(--emerald-600); }
.rt-icon.amber { background: var(--amber-50); color: var(--amber-600); }

.browse-all {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1.125rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--slate-200);
  width: 100%;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--blue-600);
  text-decoration: none;
  transition: gap 0.2s;
}

.browse-all:hover { gap: 0.55rem; }

/* ---------- All Calculators directory ---------- */
.dir-category {
  margin-bottom: 3rem;
}

.dir-category-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--slate-500);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 2px solid var(--slate-200);
}

/* ---------- Expanded footer (all pages) ---------- */
.site-footer-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  text-align: left;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--slate-200);
  margin-bottom: 1.25rem;
}

.site-footer-brand .logo {
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
}

.site-footer-brand p {
  font-size: 0.8125rem;
  color: var(--slate-400);
  max-width: 260px;
  line-height: 1.5;
}

.site-footer-col h4 {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
  margin-bottom: 0.75rem;
}

.site-footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.site-footer-col a {
  font-size: 0.8125rem;
  color: var(--slate-500);
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer-col a:hover { color: var(--blue-600); }

.site-footer-bottom {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.site-footer-bottom p {
  font-size: 0.75rem;
  color: var(--slate-400);
}

/* ---------- CTA banner ---------- */
.cta-banner {
  text-align: center;
  padding: 2.5rem 2rem;
  background: linear-gradient(135deg, var(--blue-50) 0%, var(--emerald-50) 100%);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.cta-banner h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 0.5rem;
}

.cta-banner p {
  font-size: 0.9375rem;
  color: var(--slate-600);
  margin-bottom: 1.25rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.cta-banner .btn {
  width: auto;
  display: inline-flex;
  padding: 0 2rem;
  margin-top: 0;
}

/* ---------- Informational CTA ---------- */
.info-cta {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  background: linear-gradient(135deg, var(--blue-50) 0%, var(--emerald-50) 100%);
  border: 1px solid var(--blue-100);
  border-left: 3px solid var(--blue-600);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}

.info-cta-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-cta-icon.blue  { background: var(--blue-100); color: var(--blue-600); }
.info-cta-icon.green { background: var(--emerald-100); color: var(--emerald-600); }
.info-cta-icon.amber { background: var(--amber-100); color: var(--amber-600); }

.info-cta-body h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.info-cta-body p {
  font-size: 0.8125rem;
  color: var(--slate-600);
  line-height: 1.65;
  margin: 0;
}

@media (max-width: 560px) {
  .info-cta { flex-direction: column; gap: 0.75rem; padding: 1.25rem; }
}

/* ---------- Contextual affiliate-prep note ---------- */
.affiliate-note {
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  border-left: 3px solid var(--emerald-500);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.affiliate-note h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.affiliate-note p {
  font-size: 0.875rem;
  color: var(--slate-600);
  line-height: 1.65;
  margin: 0 0 0.6rem;
}

.affiliate-note ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--slate-600);
  line-height: 1.65;
}

.affiliate-note ul li {
  margin-bottom: 0.2rem;
}

/* ---------- Ad placeholders ---------- */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  margin: 2rem 0;
  background: var(--slate-50);
  border: 1px dashed var(--slate-200);
  border-radius: var(--radius-sm);
}

.ad-slot-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--slate-300);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 2.5rem 1.5rem;
  font-size: 0.8125rem;
  color: var(--slate-400);
  background: var(--slate-50);
  border-top: 1px solid var(--slate-200);
}

/* ---------- Responsive — Tablet ---------- */
@media (max-width: 768px) {
  .container { padding: 2rem 1rem 4rem; }
  .hero h1 { font-size: 2rem; }
  .card { padding: 1.5rem; }
  .results.cols-4 { grid-template-columns: repeat(2, 1fr); }

  .hp-hero { padding: 3.5rem 1.25rem 2.5rem; }
  .hp-hero h1 { font-size: 2.125rem; }
  .hp-trust-bar { gap: 1.25rem; flex-wrap: wrap; }
  .hp-featured-card { flex-direction: column; padding: 1.75rem; gap: 1.5rem; }
  .hp-featured-visual { width: 100%; max-width: 240px; }
  .hp-audience-grid { grid-template-columns: 1fr; }
  .hp-why-grid { grid-template-columns: 1fr; }
  .hp-footer-inner { flex-direction: column; gap: 1.5rem; }
  .site-footer-inner { flex-direction: column; gap: 1.5rem; }
}

/* ---------- Responsive — Mobile ---------- */
@media (max-width: 560px) {
  .site-header { padding: 0 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .results { grid-template-columns: 1fr !important; }
  .hero { margin-bottom: 2rem; }
  .hero h1 { font-size: 1.625rem; }
  .hero p  { font-size: 0.9375rem; }
  .card { padding: 1.25rem; border-radius: 12px; }
  .card-title { font-size: 1rem; }

  /* Compact scrollable nav instead of hiding it */
  .nav-links {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.125rem;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, #000 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, #000 90%, transparent);
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    white-space: nowrap;
  }

  .tool-grid { grid-template-columns: 1fr; }
  .result-item .value { font-size: 1.25rem; }
  .data-table { font-size: 0.8125rem; }
  .data-table th, .data-table td { padding: 0.5rem; }
  .related-tools { padding: 1.5rem; }
  .related-tools-grid { grid-template-columns: 1fr; }

  .hp-hero { padding: 2.5rem 1rem 2rem; }
  .hp-hero h1 { font-size: 1.75rem; }
  .hp-hero p { font-size: 1rem; }
  .hp-trust-bar { gap: 0.75rem; padding: 1rem 0.75rem; font-size: 0.75rem; }
  .hp-trust-item span { font-size: 0.75rem; }
  .hp-section-title { font-size: 1.25rem; }
  .ad-slot { min-height: 80px; margin: 1.5rem 0; }
}
