/* ============================================================
   Cruzz — public calculator pages.
   A marketing/SEO shell around the Mel design system: readable measure for the
   prose, a sticky-free simple header, and a form that sits beside its result on
   a wide screen and stacks on a phone.
   ============================================================ */

.calc-body { min-height: 100vh; display: flex; flex-direction: column; }

.calc-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--slate-200);
}
.calc-nav { display: flex; align-items: center; gap: var(--spacing-md); }
.calc-nav a { font-weight: 700; font-size: var(--text-sm); }
.calc-nav a.btn { text-decoration: none; }

.calc-main { flex: 1; width: 100%; padding: var(--spacing-lg) var(--spacing-md) var(--spacing-xl); }
.calc-wrap { max-width: 1060px; margin: 0 auto; }

.calc-head { max-width: 62ch; margin-bottom: var(--spacing-lg); }
.calc-head h1 { font-size: var(--text-4xl); letter-spacing: -0.025em; margin: 0 0 10px; }
.calc-lead { color: var(--text-muted); font-size: var(--text-lg); line-height: 1.6; margin: 0; }

/* form beside result, stacking on narrow screens */
.calc-grid { display: grid; grid-template-columns: 340px 1fr; gap: var(--spacing-md); align-items: start; }
.calc-form .card-body { padding: var(--spacing-lg); }
.calc-pair { display: grid; grid-template-columns: 1fr auto; gap: var(--spacing-sm); }
.calc-pair .select { min-width: 104px; }

.calc-result { display: flex; flex-direction: column; gap: var(--spacing-md); min-width: 0; }
.calc-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--spacing-md); }
.calc-kpi {
  background: var(--bg-surface);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 3px;
}
.calc-kpi-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--slate-400); }
.calc-kpi-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 800; letter-spacing: -0.015em; }
.calc-kpi-note { font-size: var(--text-sm); color: var(--text-muted); }
.calc-kpi.is-interest .calc-kpi-value { color: var(--color-success); }
.calc-kpi.is-tax .calc-kpi-value { color: var(--color-error); }
.calc-kpi.is-total { border-color: color-mix(in srgb, var(--honey-500), transparent 55%); }
.calc-kpi.is-total .calc-kpi-value { color: var(--honey-700); }
/* four KPIs (the taxed page) fit two by two rather than shrinking to nothing */
.calc-kpis:has(.is-tax) { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* the card headings are <h2> for the document outline, not for their size */
.calc-wrap .card-h h2 { margin: 0; font-size: var(--text-lg); font-weight: 800; letter-spacing: -0.01em; }
.calc-chart { position: relative; height: 300px; }
.calc-table td, .calc-table th { white-space: nowrap; }
/* Every month gets its own row, so a 20-year projection is 240 of them. The box
   scrolls instead of the page, and the header stays put: at row 180 the columns
   still need to be identified. */
.calc-table-scroll { max-height: 420px; overflow: auto; overscroll-behavior: contain; }
.calc-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  /* The rows scroll *under* this, so the header has to be opaque. In the glass
     theme both --table-header-bg and --bg-surface are translucent whites (40%
     and 72%), which let row 23 read through it, and --table-border is a white
     that no border can be seen against. Hence the slate ramp, which the glass
     theme leaves alone: an opaque base with the theme tint painted over it, and
     a shadow standing in for the bottom border that border-collapse drops on a
     sticky cell. */
  background-color: var(--slate-50);
  background-image: linear-gradient(var(--table-header-bg), var(--table-header-bg));
  box-shadow: 0 1px 0 var(--slate-200);
}

/* call to action between the tool and the explainer */
.calc-cta {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--honey-50), color-mix(in srgb, var(--honey-100), transparent 40%));
  border: 1px solid color-mix(in srgb, var(--honey-500), transparent 70%);
  text-align: center;
}
.calc-cta h2 { font-size: var(--text-2xl); letter-spacing: -0.02em; margin: 0 0 8px; }
.calc-cta p { max-width: 60ch; margin: 0 auto var(--spacing-md); color: var(--slate-700); line-height: 1.65; }
.calc-cta .btn-lg { text-decoration: none; }
.calc-cta-note { display: block; margin-top: 10px; font-size: var(--text-sm); color: var(--text-muted); }

/* the explainer: a readable measure, not the full page width */
.calc-prose { max-width: 68ch; margin: var(--spacing-xl) auto 0; }
.calc-prose h2 { font-size: var(--text-2xl); letter-spacing: -0.02em; margin: var(--spacing-lg) 0 10px; }
.calc-prose h3 { font-size: var(--text-lg); margin: var(--spacing-lg) 0 8px; }
.calc-prose p { line-height: 1.75; color: var(--slate-700); margin: 0 0 12px; }
.calc-formula {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-align: center;
  overflow-x: auto;
}
.calc-formula-inline { font-family: var(--font-mono); font-size: 0.95em; white-space: nowrap; }
.calc-faq h3 { margin-top: var(--spacing-lg); }

.calc-foot {
  border-top: 1px solid var(--slate-200);
  background: var(--bg-surface);
  padding: var(--spacing-lg) var(--spacing-md);
}
.calc-foot-in {
  max-width: 1060px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--spacing-md); flex-wrap: wrap;
}
.calc-foot-in nav { display: flex; gap: var(--spacing-md); flex-wrap: wrap; }
.calc-foot-in nav a { font-size: var(--text-sm); color: var(--text-muted); font-weight: 600; }
.calc-foot-note { margin-left: auto; font-size: var(--text-sm); color: var(--slate-400); }

@media (max-width: 900px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-kpis { grid-template-columns: 1fr; }
  .calc-head h1 { font-size: var(--text-3xl); }
  .calc-foot-note { margin-left: 0; }
}

/* ---------- the index: one card per calculator ---------- */
.calc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--spacing-md); }
.calc-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: var(--spacing-lg);
  background: var(--bg-surface);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition-base), box-shadow var(--transition-base),
              border-color var(--transition-base);
}
.calc-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--honey-500), transparent 60%);
  text-decoration: none;
}
.calc-card h2 { margin: 0; font-size: var(--text-lg); letter-spacing: -0.01em; }
.calc-card p { margin: 0; color: var(--text-muted); font-size: var(--text-sm); line-height: 1.6; }
.calc-card-go { margin-top: auto; padding-top: 10px; font-size: var(--text-sm); font-weight: 700; color: var(--honey-700); }

/* Hints are reference notes, not copy: small and quiet, so the fields stay the
   loudest thing in the column. These pages don't load carteira.css, so `.help`
   gets its whole look from here. Quiet has a floor: at 12px the muted greys are
   too pale to read against the card, so this sits at slate-600 (7:1 on white)
   and stays secondary by size and weight instead of by fading out. */
.calc-body .help { font-size: 12px; line-height: 1.45; color: var(--slate-600); }
.calc-check { display: flex; align-items: center; gap: 9px; margin: 0 0 4px; font-weight: 700; font-size: var(--text-sm); cursor: pointer; }
.calc-check input { flex-shrink: 0; }
