/* ==========================================================================
   ConsultCalc design system.
   Editorial finance aesthetic. Light, authoritative, generous whitespace.
   ========================================================================== */

:root {
  --bg: #fafaf7;
  --bg-elev: #ffffff;
  --bg-muted: #f1f0ea;
  --bg-tint: #f5f3ec;
  --ink: #0f1729;
  --ink-soft: #3a4256;
  --ink-mute: #6b7388;
  --rule: #e3e0d4;
  --rule-soft: #eceadf;
  --accent: #0e6b4f;          /* sophisticated forest green */
  --accent-deep: #0a5640;
  --accent-soft: #e6f1ec;
  --warn: #b6541a;            /* terracotta for callouts */
  --warn-soft: #fbf1e8;
  --info-soft: #eef1f6;
  --shadow-sm: 0 1px 2px rgba(15, 23, 41, 0.04), 0 1px 3px rgba(15, 23, 41, 0.05);
  --shadow-md: 0 4px 14px rgba(15, 23, 41, 0.06), 0 1px 3px rgba(15, 23, 41, 0.04);
  --radius: 6px;
  --radius-lg: 12px;
  --max: 1140px;
  --read: 720px;
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

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

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

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { max-width: 100%; display: block; }

a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 120ms ease;
}
a:hover { color: var(--accent); text-decoration-thickness: 2px; }

/* ---------- Layout ---------- */
.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.read { max-width: var(--read); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; max-width: var(--max); margin: 0 auto;
}
.brand {
  font-family: var(--serif);
  font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: baseline; gap: 2px;
}
.brand__mark { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 15px; font-weight: 500;
}
.nav a:hover { color: var(--accent-deep); }
.nav__cta {
  background: var(--ink); color: #fff !important; padding: 8px 14px;
  border-radius: var(--radius); font-weight: 500;
}
.nav__cta:hover { background: var(--accent-deep); }
.nav-toggle { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.nav-toggle svg { width: 24px; height: 24px; stroke: var(--ink); }

@media (max-width: 720px) {
  .nav { display: none; gap: 16px; }
  .nav.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-elev); padding: 16px 24px; border-bottom: 1px solid var(--rule);
  }
  .nav-toggle { display: inline-flex; }
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; color: var(--ink); letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: clamp(2rem, 4vw, 2.75rem); margin-bottom: 0.5em; }
h2 { font-size: clamp(1.5rem, 2.5vw, 1.875rem); margin: 2em 0 0.6em; }
h3 { font-size: 1.25rem; margin: 1.6em 0 0.4em; }
h4 { font-size: 1.05rem; margin: 1.4em 0 0.3em; font-weight: 600; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; font-weight: 600;
  color: var(--accent-deep); font-family: var(--sans); margin-bottom: 12px;
}
.lede { font-size: 1.125rem; line-height: 1.65; color: var(--ink-soft); margin-bottom: 1.5em; }

/* ---------- Prose (article body) ---------- */
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { margin: 0 0 1.2em 1.4em; }
.prose ul li, .prose ol li { margin-bottom: 0.5em; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 18px;
  margin: 1.5em 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.1rem;
  font-style: italic;
}
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; }

/* ---------- Calculator ---------- */
.calc {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
  margin: 24px 0 40px;
}
@media (max-width: 600px) { .calc { padding: 22px 18px; } }

.calc__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
}
@media (max-width: 800px) { .calc__grid { grid-template-columns: 1fr; gap: 24px; } }

.calc__inputs h2, .calc__results h2 {
  font-family: var(--sans); font-size: 14px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-mute); margin: 0 0 16px;
}

.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 14px; font-weight: 500; color: var(--ink-soft);
  margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--ink-mute); margin-top: 4px; }
.field input[type="number"], .field input[type="text"], .field select {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  transition: border-color 120ms, box-shadow 120ms;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field .input-wrap {
  position: relative;
}
.field .input-wrap__prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-mute); font-weight: 500; pointer-events: none;
}
.field .input-wrap input { padding-left: 26px; }

.calc__results {
  background: var(--bg-tint);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.result-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--rule);
}
.result-row:last-of-type { border-bottom: 0; }
.result-row__label { color: var(--ink-soft); font-size: 14px; }
.result-row__value {
  font-variant-numeric: tabular-nums;
  font-weight: 600; font-size: 18px; color: var(--ink);
}
.result-row--total { padding-top: 18px; margin-top: 6px; border-top: 2px solid var(--ink); border-bottom: 0; }
.result-row--total .result-row__label { font-weight: 600; color: var(--ink); font-size: 15px; }
.result-row--total .result-row__value { font-size: 26px; color: var(--accent-deep); font-family: var(--serif); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.5em 0; border: 1px solid var(--rule); border-radius: var(--radius); }
table {
  width: 100%; border-collapse: collapse; font-size: 15px;
}
th, td {
  text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--rule);
}
th { background: var(--bg-tint); font-weight: 600; font-size: 13px; color: var(--ink); text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Callouts ---------- */
.callout {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 1.5em 0;
  font-size: 15px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}
.callout--warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout--info { border-left-color: #5168a8; background: var(--info-soft); }
.callout strong:first-child { display: inline-block; margin-bottom: 4px; }

/* ---------- FAQ ---------- */
.faq details {
  border-bottom: 1px solid var(--rule);
  padding: 16px 0;
}
.faq details:last-child { border-bottom: 0; }
.faq summary {
  cursor: pointer; font-weight: 600; font-size: 17px; color: var(--ink);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-size: 22px; color: var(--accent-deep); font-weight: 400;
  transition: transform 200ms;
}
.faq details[open] summary::after { content: "−"; }
.faq details > *:not(summary) { margin-top: 12px; color: var(--ink-soft); font-size: 16px; line-height: 1.65; }

/* ---------- Author bio ---------- */
.author {
  display: flex; gap: 18px; padding: 22px;
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--bg-elev); margin: 2em 0;
}
.author__avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--serif); font-size: 24px; font-weight: 600;
}
.author__name { font-weight: 600; font-size: 16px; color: var(--ink); margin: 0 0 2px; }
.author__role { font-size: 13px; color: var(--ink-mute); margin-bottom: 8px; }
.author__bio { font-size: 14px; color: var(--ink-soft); line-height: 1.55; }
.author__links { margin-top: 8px; font-size: 13px; }

/* ---------- Hero ---------- */
.hero {
  padding: 72px 24px 56px;
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--rule);
}
.hero__inner { max-width: var(--max); margin: 0 auto; }
.hero h1 { max-width: 780px; }
.hero .lede { max-width: 640px; }

/* ---------- Calculator catalog (homepage grid) ---------- */
.catalog {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px; margin: 32px 0;
}
.cat-card {
  display: block; padding: 22px; border: 1px solid var(--rule);
  border-radius: var(--radius-lg); background: var(--bg-elev);
  text-decoration: none; color: var(--ink);
  transition: transform 150ms, box-shadow 150ms, border-color 150ms;
}
.cat-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: var(--accent); color: var(--ink);
}
.cat-card__tag {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent-deep); margin-bottom: 10px;
}
.cat-card__title {
  font-family: var(--serif); font-size: 19px; font-weight: 600;
  line-height: 1.3; margin-bottom: 8px;
}
.cat-card__desc { font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.cat-card--stub { opacity: 0.6; cursor: default; }
.cat-card--stub:hover { transform: none; box-shadow: none; border-color: var(--rule); }

/* ---------- Section dividers / labels ---------- */
.section-label {
  font-family: var(--sans); font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-mute); font-weight: 600;
  display: flex; align-items: center; gap: 12px; margin: 48px 0 16px;
}
.section-label::after {
  content: ""; flex: 1; height: 1px; background: var(--rule);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 12px 22px;
  font: 500 15px/1 var(--sans); text-decoration: none;
  border-radius: var(--radius); border: 0; cursor: pointer;
  transition: background 120ms, transform 120ms;
}
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: var(--accent-deep); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink); color: #b8bdc9;
  padding: 56px 24px 32px; margin-top: 80px;
}
.site-footer__inner {
  max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px;
}
@media (max-width: 720px) { .site-footer__inner { grid-template-columns: 1fr; gap: 32px; } }
.site-footer h4 {
  color: #fff; font-family: var(--sans); font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 14px;
}
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { margin-bottom: 8px; font-size: 14px; }
.site-footer a { color: #b8bdc9; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer__brand { font-family: var(--serif); font-size: 22px; color: #fff; margin-bottom: 8px; display: block; text-decoration: none; }
.site-footer__tagline { font-size: 14px; max-width: 320px; margin-bottom: 12px; }
.site-footer__email { font-size: 13px; color: #8d92a3; margin-bottom: 12px; }
.site-footer__email a { color: #c8cdd9; }
.site-footer__email a:hover { color: #fff; }
.site-footer__legal {
  border-top: 1px solid #2a334a; margin-top: 40px; padding-top: 20px;
  font-size: 12px; color: #6c7488; text-align: center;
}

/* ---------- Ad slot placeholder ---------- */
.ad-slot {
  background: repeating-linear-gradient(45deg, var(--bg-tint), var(--bg-tint) 8px, var(--bg-muted) 8px, var(--bg-muted) 16px);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  text-align: center;
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
  margin: 28px 0;
}
.ad-slot--leaderboard { min-height: 90px; }
.ad-slot--rectangle { min-height: 250px; max-width: 336px; margin-left: auto; margin-right: auto; }
.ad-slot--inarticle { min-height: 280px; }
/* Ad slots are hidden until AdSense is approved (uncomment after). */
/* .ad-slot { display: none; } */

/* ---------- Disclosure ---------- */
.disclosure {
  font-size: 12px; color: var(--ink-mute); padding: 10px 14px;
  background: var(--bg-tint); border-radius: var(--radius);
  margin: 0 0 18px;
}

/* ---------- Homepage typeahead search ---------- */
.search {
  position: relative;
  max-width: 560px;
  margin: 24px 0 12px;
}
.search__icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--ink-mute); pointer-events: none;
}
.search__input {
  width: 100%;
  padding: 14px 16px 14px 46px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.search__input:focus {
  outline: none;
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search__input::-webkit-search-cancel-button { cursor: pointer; }
.search__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 20;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
}
.search__result {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  gap: 12px;
}
.search__result:hover, .search__result--active {
  background: var(--bg-tint);
  color: var(--ink);
}
.search__result-title { flex: 1; }
.search__result-title mark {
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 0 1px; border-radius: 2px;
}
.search__result-tag {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-mute);
  white-space: nowrap;
}
.search__hint {
  font-size: 13px; color: var(--ink-mute); margin: 0;
}
.search__hint a { color: var(--accent-deep); }

/* ---------- Category index page ---------- */
.cat-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}
.cat-index__section {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.cat-index__section h3 {
  font-family: var(--serif);
  font-size: 17px; font-weight: 600;
  margin: 0 0 10px;
  color: var(--ink);
}
.cat-index__abbr {
  font-family: var(--mono);
  font-size: 13px; font-weight: 400;
  color: var(--ink-mute);
  margin-left: 4px;
}
.cat-index__section ul {
  list-style: none; padding: 0; margin: 0;
}
.cat-index__section li { margin-bottom: 6px; font-size: 14px; }
.cat-index__section a {
  color: var(--accent-deep);
  text-decoration: none;
}
.cat-index__section a:hover { text-decoration: underline; }

/* ---------- Conversion-page calculator ---------- */
.convert {
  background: var(--bg-tint);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin: 24px 0;
}
.convert__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px; align-items: end;
}
@media (max-width: 640px) {
  .convert__row { grid-template-columns: 1fr; }
  .convert__equals { justify-self: center; padding: 8px 0; }
}
.convert__cell label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--ink-soft); margin-bottom: 6px;
}
.convert__cell .input-wrap {
  position: relative;
}
.convert__cell .input-wrap input {
  width: 100%;
  padding: 12px 56px 12px 14px;
  font-size: 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}
.convert__cell .input-wrap input:focus {
  outline: none; border-color: var(--accent-deep);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-wrap__suffix {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-mute); font-weight: 500; font-size: 14px;
  pointer-events: none;
}
.convert__equals {
  font-size: 24px; font-weight: 600; color: var(--ink-mute);
  padding: 0 4px 12px;
}
.convert__swap {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  margin-bottom: 6px;
  font-size: 18px; font-weight: 600;
  color: var(--accent-deep);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 50%;
  text-decoration: none;
  transition: background 120ms, border-color 120ms, transform 120ms;
  justify-self: center;
}
.convert__swap:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  text-decoration: none;
  transform: rotate(180deg);
}
.convert .hint, .convert + .hint, #result-text {
  font-size: 14px; color: var(--ink-soft); margin-top: 14px;
}

/* ---------- Breadcrumbs ---------- */
.crumbs { font-size: 13px; color: var(--ink-mute); margin-bottom: 14px; }
.crumbs a { color: var(--ink-mute); text-decoration: none; }
.crumbs a:hover { color: var(--accent-deep); }
.crumbs span { margin: 0 6px; }

/* ---------- Utility ---------- */
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 40px; } .mt-5 { margin-top: 64px; }
.text-mute { color: var(--ink-mute); }
.text-center { text-align: center; }
.tabular { font-variant-numeric: tabular-nums; }
.no-break { white-space: nowrap; }
