/* ============================================================
   ClearCalc — shared design system
   Light, precise "financial instrument" aesthetic.
   Signature: dark navy result "readout" with mono-figure numbers.
   ============================================================ */

:root {
  /* Palette */
  --bg:        #eef1f5;
  --bg-grain:  #e7ebf1;
  --surface:   #ffffff;
  --ink:       #0d1726;
  --ink-soft:  #5b6678;
  --ink-faint: #8a94a6;
  --line:      #e1e6ee;
  --line-soft: #edf0f5;
  --navy:      #101d31;
  --navy-2:    #16263f;
  --money:     #14a06a;
  --money-lit: #2fd58e;   /* readout glow green */
  --money-dk:  #0c7e52;
  --loss:      #e2574c;
  --loss-lit:  #ff7d72;
  --amber:     #c6841a;
  --accent:    #2b4a78;    /* interactive blue-slate */
  --accent-dk: #1d335a;

  /* Type */
  --display: "Space Grotesk", system-ui, sans-serif;
  --body:    "Inter", system-ui, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, monospace;

  /* Geometry */
  --radius:   14px;
  --radius-sm: 9px;
  --maxw:     1080px;
  --shadow:   0 1px 2px rgba(16,29,49,.05), 0 8px 28px -12px rgba(16,29,49,.18);
  --shadow-lg: 0 2px 6px rgba(16,29,49,.06), 0 24px 60px -22px rgba(16,29,49,.34);
}

/* * */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, #f6f8fb 0%, transparent 60%),
    var(--bg);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(238,241,245,.82);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; display: block; }
.brand .word {
  font-family: var(--display); font-weight: 700; font-size: 1.18rem;
  letter-spacing: -.02em; color: var(--ink);
}
.brand .word b { color: var(--money-dk); font-weight: 700; }
.nav { display: flex; align-items: center; gap: 26px; }
.nav a {
  font-size: .92rem; font-weight: 500; color: var(--ink-soft);
  letter-spacing: -.01em;
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--ink); }

@media (max-width: 620px) {
  .nav { gap: 16px; }
  .nav a.nav-extra { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding: 58px 0 26px; }
.eyebrow {
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--money-dk);
  display: inline-flex; align-items: center; gap: 9px;
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: var(--money);
  display: inline-block;
}
.hero h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.05rem); line-height: 1.04;
  letter-spacing: -.035em; margin: 16px 0 0; max-width: 16ch;
}
.hero p.lede {
  font-size: clamp(1rem, 2.2vw, 1.18rem); color: var(--ink-soft);
  max-width: 56ch; margin: 16px 0 0;
}

/* ---------- Calculator layout ---------- */
.calc {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 22px;
  align-items: start; margin: 30px 0 10px;
}
@media (max-width: 880px) {
  .calc { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 24px; }
@media (max-width: 520px) { .card-pad { padding: 18px; } }

.card-title {
  font-family: var(--display); font-weight: 600; font-size: 1.06rem;
  letter-spacing: -.02em; margin: 0 0 2px;
}
.card-sub { color: var(--ink-faint); font-size: .86rem; margin: 0 0 18px; }

/* Inputs */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 6px; letter-spacing: -.01em;
}
.field .hint { color: var(--ink-faint); font-weight: 400; }

.input-shell {
  display: flex; align-items: center; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fbfcfe; transition: border-color .15s, box-shadow .15s, background .15s;
}
.input-shell:focus-within {
  border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(43,74,120,.13);
}
.input-shell .affix {
  font-family: var(--mono); font-size: .9rem; color: var(--ink-faint);
  padding: 0 4px 0 12px; user-select: none;
}
.input-shell .affix.suffix { padding: 0 12px 0 4px; }
.input-shell input {
  flex: 1; width: 100%; border: 0; outline: 0; background: transparent;
  font-family: var(--mono); font-size: .98rem; font-weight: 500; color: var(--ink);
  padding: 11px 12px; min-width: 0;
}
.input-shell.has-prefix input { padding-left: 4px; }
.input-shell input::placeholder { color: #b9c1cf; font-weight: 400; }
/* hide number spinners */
.input-shell input::-webkit-outer-spin-button,
.input-shell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-shell input[type=number] { -moz-appearance: textfield; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
@media (max-width: 420px) { .field-row { grid-template-columns: 1fr; } }

select.select {
  width: 100%; font-family: var(--body); font-size: .95rem; color: var(--ink);
  padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fbfcfe url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%235b6678' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none; -webkit-appearance: none; cursor: pointer;
}
select.select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,74,120,.13); }

/* segmented control */
.seg { display: inline-flex; background: var(--line-soft); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--body); font-size: .82rem; font-weight: 600; color: var(--ink-soft);
  padding: 7px 13px; border-radius: 6px; transition: background .15s, color .15s;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16,29,49,.12); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: #cdd5e0; border-radius: 99px;
  transition: background .18s; cursor: pointer;
}
.switch .track::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--money); }
.switch input:checked + .track::before { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(43,74,120,.25); }

/* ---------- Readout (signature) ---------- */
.readout {
  position: sticky; top: 80px;
  background:
    radial-gradient(120% 120% at 100% 0%, #1b2f4d 0%, var(--navy) 55%);
  color: #eaf1fb; border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden; border: 1px solid #0a1322;
}
@media (max-width: 880px) { .readout { position: static; } }
.readout-top {
  padding: 20px 22px 18px; border-bottom: 1px solid rgba(255,255,255,.07);
}
.readout-label {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: #8aa0c0; display: flex; align-items: center; gap: 8px;
}
.readout-label .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--money-lit); box-shadow: 0 0 8px var(--money-lit); }
.readout-hero {
  font-family: var(--mono); font-weight: 700; letter-spacing: -.02em;
  font-size: clamp(2.1rem, 7vw, 2.9rem); line-height: 1.05; margin: 8px 0 0;
  color: #fff; font-variant-numeric: tabular-nums;
}
.readout-hero.pos { color: var(--money-lit); }
.readout-hero.neg { color: var(--loss-lit); }
.readout-chip {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: .78rem; font-weight: 600; padding: 5px 11px; border-radius: 99px;
  background: rgba(47,213,142,.14); color: var(--money-lit); border: 1px solid rgba(47,213,142,.28);
}
.readout-chip.warn { background: rgba(198,132,26,.16); color: #f0b860; border-color: rgba(198,132,26,.35); }
.readout-chip.bad  { background: rgba(255,125,114,.14); color: var(--loss-lit); border-color: rgba(255,125,114,.3); }

.readout-grid {
  display: grid; grid-template-columns: 1fr 1fr;
}
.stat {
  padding: 15px 22px; border-top: 1px solid rgba(255,255,255,.07);
}
.stat:nth-child(odd) { border-right: 1px solid rgba(255,255,255,.07); }
.stat .k {
  font-family: var(--mono); font-size: .64rem; letter-spacing: .13em;
  text-transform: uppercase; color: #7e94b4;
}
.stat .v {
  font-family: var(--mono); font-weight: 600; font-size: 1.2rem; margin-top: 4px;
  color: #eef4fc; font-variant-numeric: tabular-nums;
}
.stat .v.pos { color: var(--money-lit); }
.stat .v.neg { color: var(--loss-lit); }
.readout-foot {
  padding: 13px 22px; font-size: .73rem; color: #7286a4;
  border-top: 1px solid rgba(255,255,255,.07); background: rgba(0,0,0,.16);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--body); font-weight: 600; font-size: .95rem;
  padding: 12px 20px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid transparent; transition: transform .12s, background .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #1c2c45; transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-soft); background: #fff; }
.btn-money { background: var(--money); color: #fff; }
.btn-money:hover { background: var(--money-dk); transform: translateY(-1px); }
.btn-link { background: transparent; color: var(--accent); padding: 6px 0; font-weight: 600; }
.btn-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Content sections ---------- */
.section { padding: 30px 0; }
.section h2 {
  font-family: var(--display); font-weight: 600; font-size: clamp(1.4rem, 3.4vw, 1.9rem);
  letter-spacing: -.03em; margin: 0 0 6px;
}
.section .section-sub { color: var(--ink-soft); margin: 0 0 22px; max-width: 60ch; }

.prose { max-width: 70ch; }
.prose p { color: #2b3647; margin: 0 0 15px; }
.prose h3 {
  font-family: var(--display); font-weight: 600; font-size: 1.12rem;
  letter-spacing: -.02em; margin: 26px 0 8px;
}

/* step list */
.steps { display: grid; gap: 14px; counter-reset: s; padding: 0; margin: 0; list-style: none; }
.steps li {
  display: grid; grid-template-columns: 34px 1fr; gap: 14px; align-items: start;
}
.steps li .n {
  counter-increment: s; font-family: var(--mono); font-weight: 700; font-size: .85rem;
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--line); color: var(--money-dk);
}
.steps li .n::before { content: counter(s, decimal-leading-zero); }
.steps li h4 { font-family: var(--display); font-weight: 600; font-size: 1rem; margin: 4px 0 2px; letter-spacing: -.01em; }
.steps li p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

/* FAQ */
.faq { display: grid; gap: 0; border-top: 1px solid var(--line); }
.faq details {
  border-bottom: 1px solid var(--line); padding: 4px 0;
}
.faq summary {
  list-style: none; cursor: pointer; padding: 16px 38px 16px 2px; position: relative;
  font-family: var(--display); font-weight: 600; font-size: 1.03rem; letter-spacing: -.01em;
  color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-weight: 500; font-size: 1.3rem; color: var(--ink-faint);
  transition: transform .18s;
}
.faq details[open] summary::after { content: "−"; }
.faq details[open] summary { color: var(--money-dk); }
.faq .answer { padding: 0 2px 18px; color: var(--ink-soft); max-width: 70ch; }
.faq .answer p { margin: 0 0 10px; }
.faq .answer p:last-child { margin: 0; }

/* ---------- Tool cards (home) ---------- */
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 30px; }
@media (max-width: 760px) { .tool-grid { grid-template-columns: 1fr; } }
.tool-card {
  position: relative; padding: 26px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d3dae6; text-decoration: none; }
.tool-card .tc-ic {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(145deg, #eafaf2, #d6f3e5); color: var(--money-dk);
}
.tool-card h3 { font-family: var(--display); font-weight: 600; font-size: 1.18rem; letter-spacing: -.02em; margin: 0; color: var(--ink); }
.tool-card p { margin: 0; color: var(--ink-soft); font-size: .95rem; flex: 1; }
.tool-card .tc-go { font-family: var(--mono); font-size: .8rem; font-weight: 600; color: var(--money-dk); letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 6px; }
.tool-card .tag {
  position: absolute; top: 20px; right: 20px; font-family: var(--mono); font-size: .64rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 99px; padding: 3px 9px;
}

/* feature strip */
.feat-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; margin-top: 34px; }
@media (max-width: 760px) { .feat-strip { grid-template-columns: 1fr; gap: 12px; } }
.feat { display: flex; gap: 12px; align-items: flex-start; }
.feat .fi { color: var(--money-dk); flex: none; margin-top: 2px; }
.feat h4 { font-family: var(--display); font-weight: 600; font-size: 1rem; margin: 0 0 3px; letter-spacing: -.01em; }
.feat p { margin: 0; color: var(--ink-soft); font-size: .9rem; }

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 26px auto; max-width: var(--maxw); text-align: center;
  min-height: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: 10px; background: #f3f5f9;
  padding: 0 22px;
}
.ad-slot::before {
  content: "Advertisement"; font-family: var(--mono); font-size: .62rem; letter-spacing: .14em;
  text-transform: uppercase; color: #aab3c2; margin-bottom: 6px;
}
.ad-slot .adsbygoogle { display: block; }
.ad-note { font-size: .72rem; color: #aab3c2; }

/* disclaimer */
.disclaimer {
  margin-top: 18px; font-size: .82rem; color: var(--ink-faint);
  background: #f4f6fa; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
}
.disclaimer strong { color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 40px; border-top: 1px solid var(--line);
  background: #fff;
}
.site-footer .wrap { padding-top: 34px; padding-bottom: 34px; }
.foot-grid { display: flex; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.foot-brand { max-width: 30ch; }
.foot-brand p { color: var(--ink-soft); font-size: .88rem; margin: 10px 0 0; }
.foot-cols { display: flex; gap: 54px; flex-wrap: wrap; }
.foot-col h5 { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 12px; }
.foot-col a { display: block; color: var(--ink-soft); font-size: .9rem; margin-bottom: 9px; }
.foot-col a:hover { color: var(--ink); text-decoration: none; }
.foot-base {
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: .82rem; color: var(--ink-faint);
}

/* utility */
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
