/*
  Styles for the free calculator pages (docs/specs/066-free-seo-calculator-pages.md):
  /brrrr-calculator and /fix-and-flip-calculator.

  The tokens, header, buttons, FAQ and footer are copied from landing.html (spec 047's design
  tokens, the same as frontend/src/index.css) so these pages look like part of the same site. They're
  copied rather than shared because landing.html keeps its CSS inline on purpose (it's one
  self-contained file). If the landing look changes, update both. Everything calculator-specific
  is under "Calculator" below.
*/
:root {
  --navy: #0b1220;
  --navy-2: #131c2e;
  --navy-3: #1e293b;
  --slate: #94a3b8;
  --slate-2: #cbd5e1;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --subtle: #f8fafc;
  --border: #e5e7eb;
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --accent: #059669;
  --accent-hover: #047857;
  --accent-soft: #ecfdf5;
  --accent-text: #065f46;
  --accent-bright: #34d399;
  --danger: #b91c1c;
  --brrrr: #6d28d9;
  --flip: #1d4ed8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text-1);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); }
.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 24px; }
.num, output { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 9px; padding: 10px 18px; font-weight: 600; font-size: 14.5px;
  text-decoration: none; border: 1px solid transparent; white-space: nowrap; cursor: pointer;
  font-family: inherit; transition: background 120ms, border-color 120ms;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.outline { background: var(--surface); color: var(--text-1); border-color: var(--border); }
.btn.outline:hover { border-color: #cbd5e1; background: var(--subtle); }
.btn.big { padding: 14px 22px; font-size: 16px; border-radius: 10px; }
.btn.block { display: flex; width: 100%; }

/* ---------- Dark top band (header + title) ---------- */
.top {
  background: radial-gradient(600px 360px at 80% 40%, rgba(5, 150, 105, 0.16), transparent 70%), var(--navy);
  color: #fff;
}
header.site { position: sticky; top: 0; z-index: 10; background: rgba(11, 18, 32, 0.92); backdrop-filter: blur(8px); }
header.site .bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 72px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; font-weight: 700; font-size: 18px; }
.logo .mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #fff; }
nav.primary { display: flex; gap: 28px; }
nav.primary a { color: var(--slate-2); text-decoration: none; font-size: 14.5px; font-weight: 500; }
nav.primary a:hover, nav.primary a[aria-current="page"] { color: #fff; }
.actions { display: flex; align-items: center; gap: 22px; }
.actions .login { color: #fff; text-decoration: none; font-size: 14.5px; font-weight: 600; }

.intro { padding-block: 40px 88px; }
.intro > * { max-width: 760px; }
.crumbs { font-size: 13px; color: var(--slate); margin: 0 0 14px; }
.crumbs a { color: var(--slate-2); text-decoration: none; }
.intro h1 { font-size: clamp(34px, 4.6vw, 52px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 800; margin: 0 0 16px; }
.intro p { font-size: 17.5px; line-height: 1.6; color: var(--slate); margin: 0; }

/* Switch between the two calculators (also an internal link for Google). */
.switcher { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 11px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); margin-top: 26px; }
.switcher a { padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--slate-2); text-decoration: none; }
.switcher a[aria-current="page"] { background: var(--accent); color: #fff; }
.switcher a:not([aria-current]):hover { color: #fff; background: rgba(255, 255, 255, 0.06); }

/* ---------- Calculator ---------- */
.calc-section { background: var(--bg); padding-bottom: 72px; }
.calc { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: -56px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: 0 18px 40px -24px rgba(15, 23, 42, 0.25); }
.card h2 { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.card .hint { font-size: 13.5px; color: var(--text-2); margin: 0 0 18px; }

fieldset { border: 0; margin: 0 0 18px; padding: 0; }
legend { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; padding: 0; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field .box { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); transition: border-color 120ms, box-shadow 120ms; }
.field .box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15); }
.field .box span { padding-inline: 11px; color: var(--text-3); font-size: 14px; white-space: nowrap; }
.field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; padding: 10px 11px; font: inherit; font-size: 15px; color: var(--text-1); font-variant-numeric: tabular-nums; }
.field .box span + input { padding-left: 0; }
.field input[aria-invalid="true"] { color: var(--danger); }
.field small { display: block; font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.4; }

details.advanced { border-top: 1px solid var(--border); padding-top: 14px; }
details.advanced > summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent-text); list-style: none; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: '+ '; }
details.advanced[open] > summary::before { content: '− '; }
details.advanced .fields { margin-top: 14px; }
details.advanced p { font-size: 13px; color: var(--text-2); line-height: 1.55; margin: 12px 0 0; }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; font-size: 12.5px; color: var(--text-3); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); text-decoration: underline; cursor: pointer; }

.results { position: sticky; top: 88px; }
.results .summary { font-size: 15px; line-height: 1.5; color: var(--text-2); margin: 0 0 16px; }
.headline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.headline div { border: 1px solid var(--border); background: var(--subtle); border-radius: 12px; padding: 14px; }
.headline span { display: block; font-size: 12.5px; color: var(--text-2); }
.headline output { display: block; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.headline div.main { border-color: var(--accent); background: var(--accent-soft); }
output[data-sign="neg"] { color: var(--danger); }
.headline div.main output[data-sign="pos"] { color: var(--accent-text); }
dl.lines { margin: 0; display: grid; grid-template-columns: 1fr auto; row-gap: 9px; column-gap: 16px; font-size: 14px; }
dl.lines dt { color: var(--text-2); }
dl.lines dd { margin: 0; text-align: right; font-weight: 600; }
dl.lines .sep { grid-column: 1 / -1; border-top: 1px solid var(--border); margin: 4px 0; }

.cta-box { margin-top: 18px; border-radius: 14px; padding: 20px; background: var(--navy); color: #fff; }
.cta-box strong { display: block; font-size: 16px; margin-bottom: 6px; }
.cta-box p { margin: 0 0 14px; font-size: 14px; line-height: 1.55; color: var(--slate-2); }
.fineprint { font-size: 12px; line-height: 1.5; color: var(--text-3); margin: 12px 0 0; }
.fineprint a { color: var(--text-2); }

/* "Over / under" line on the 70% rule page: red when the asking price is above the max offer. */
output[data-out="askingOverMax"][data-sign="pos"] { color: var(--danger); }
output[data-out="askingOverMax"][data-sign="neg"] { color: var(--accent-text); }

/* ---------- Article content ---------- */
.article { padding-block: 72px; }
.prose { max-width: 760px; margin: 0 auto; font-size: 16.5px; line-height: 1.7; color: var(--text-1); }
.prose h2 { font-size: clamp(24px, 2.8vw, 30px); line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; margin: 48px 0 14px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 18px; margin: 28px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; color: var(--text-2); }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--text-1); }
.prose .formula { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 14px; background: var(--subtle); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--text-1); overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 0 0 18px; font-variant-numeric: tabular-nums; }
.prose th, .prose td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.prose td:last-child, .prose th:last-child { text-align: right; }
.prose tr.total td { font-weight: 700; color: var(--text-1); }
.table-scroll { overflow-x: auto; }

.faq { max-width: 760px; margin: 0 auto; }
.faq details { border-bottom: 1px solid var(--border); padding: 18px 0; }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 16px; font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 22px; font-weight: 400; color: var(--text-3); line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 10px 0 0; font-size: 15px; line-height: 1.6; color: var(--text-2); }

.cta { padding-block: 0 88px; }
.cta-card { background: radial-gradient(500px 260px at 50% 0%, rgba(5, 150, 105, 0.18), transparent 70%), var(--navy); color: #fff; border-radius: 20px; padding: 64px 24px; text-align: center; }
.cta-card h2 { font-size: clamp(26px, 3.2vw, 38px); letter-spacing: -0.025em; line-height: 1.15; font-weight: 700; margin: 0 auto 14px; max-width: 18em; }
.cta-card p { margin: 0 auto 26px; font-size: 16px; color: var(--slate); max-width: 34em; line-height: 1.6; }

footer.site { background: var(--navy); color: var(--slate); padding-block: 56px 32px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
.footer-brand .logo { color: #fff; }
.footer-brand p { margin: 14px 0 0; line-height: 1.6; max-width: 30em; }
footer h4 { margin: 0 0 14px; color: #fff; font-size: 13.5px; font-weight: 600; }
footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
footer a { color: var(--slate); text-decoration: none; }
footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid var(--navy-3); margin-top: 44px; padding-top: 22px; font-size: 12.5px; line-height: 1.6; }
.footer-bottom p { margin: 0 0 8px; }

@media (max-width: 960px) {
  nav.primary { display: none; }
  .calc { grid-template-columns: 1fr; }
  .results { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding-inline: 16px; }
  .actions .login { display: none; }
  .intro { padding-block: 28px 76px; }
  .fields { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .headline output { font-size: 22px; }
  .article { padding-block: 56px; }
  /* Four calculators don't fit in one row at phone width: two by two. */
  .switcher { display: grid; grid-template-columns: 1fr 1fr; }
  .switcher a { text-align: center; padding-inline: 8px; }
}
