/* Saver's Match Calculator. System fonts only: no font files, no third-party requests. */
:root {
  --paper: #EDF3EE;
  --surface: #FFFFFF;
  --ink: #12241C;
  --muted: #4A5D54;
  --green: #0B6B4B;
  --green-bright: #17A673;
  --you: #283A52;
  --gold: #F2B705;
  --gold-wash: #FFF6D6;
  --line: #C6D4CA;
  --display: Rockwell, "Rockwell Nova", "Roboto Slab", "DejaVu Serif", "Sitka Small", Georgia, serif;
  --body: Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro, system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
  padding-bottom: 4.5rem;
}
a { color: var(--green); text-underline-offset: 0.15em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  max-width: 68rem; margin: 0 auto; padding: 0.9rem 1.1rem;
}
.brand { font-family: var(--display); font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.top-note { color: var(--muted); font-size: 0.875rem; text-align: right; white-space: nowrap; }
.top-note .wide { display: none; }

main { max-width: 68rem; margin: 0 auto; padding: 0 1.1rem; }

/* The tool: questions on the left, the deposit slip on the right. */
.tool { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
.intro h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2rem, 6.5vw, 3.25rem); line-height: 1.05; letter-spacing: -0.01em;
  margin: 0.4rem 0 0.6rem;
}
.lede { margin: 0; max-width: 38rem; color: var(--muted); }

.questions { display: grid; gap: 1.4rem; align-content: start; }
.q { border: 0; margin: 0; padding: 0; min-width: 0; }
.q > label, .q > legend, .helper label, .more > label {
  display: block; font-weight: 700; font-size: 1.0625rem; padding: 0; margin-bottom: 0.2rem;
}
.hint { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9375rem; max-width: 36rem; }
.where { font-weight: 400; color: var(--muted); font-size: 0.875rem; white-space: nowrap; }

.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: block; padding: 0.5rem 0.85rem; background: var(--surface);
  border: 2px solid var(--line); border-radius: 999px; font-size: 1rem;
}
.choice input:checked + span { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.choice input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

.money {
  display: flex; align-items: center; max-width: 16rem;
  background: var(--surface); border: 2px solid var(--line); border-radius: 0.5rem;
}
.money:focus-within { border-color: var(--green); }
.money span { padding-left: 0.8rem; color: var(--muted); font-family: var(--display); font-size: 1.25rem; }
.money input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: 700 1.375rem/1.2 var(--display); font-variant-numeric: tabular-nums;
  padding: 0.6rem 0.8rem 0.6rem 0.35rem;
}
.money input:focus { outline: none; }

details > summary { cursor: pointer; color: var(--green); font-weight: 700; width: fit-content; padding: 0.25rem 0; }
.helper { margin-top: 0.6rem; }
.helper[open], .more[open] { background: rgba(255, 255, 255, 0.6); border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.6rem 1rem 1rem; }
.helper label, .more > label { margin-top: 0.8rem; font-size: 1rem; }
.helper .money, .more .money { max-width: 14rem; }

.checks { border: 0; padding: 0; margin: 1rem 0 0; }
.checks legend { font-weight: 700; padding: 0; margin-bottom: 0.3rem; }
.checks label { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.3rem 0; }
.checks input { width: 1.2rem; height: 1.2rem; margin-top: 0.15rem; accent-color: var(--green); flex: none; }

.clear {
  justify-self: start; background: none; border: 0; padding: 0.3rem 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 0.9375rem; text-decoration: underline; text-underline-offset: 0.15em;
}

/* The slip is the one loud thing on the page: a deposit receipt with a tear line. */
.slip {
  position: relative; align-self: start; background: var(--surface);
  border-radius: 0.75rem; padding: 1.4rem 1.3rem 1.1rem;
  box-shadow: 0 1px 0 var(--line), 0 14px 30px -18px rgba(18, 36, 28, 0.45);
  scroll-margin-top: 1rem;
}
.slip::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 0.5rem;
  border-radius: 0.75rem 0.75rem 0 0; background: var(--green);
}
.slip-title { margin: 0.3rem 0 0.5rem; color: var(--muted); font-size: 0.9375rem; }
.slip-amount {
  margin: 0; font-family: var(--display); font-weight: 700; color: var(--green);
  font-size: clamp(3.25rem, 15vw, 5rem); line-height: 1.1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.slip.is-zero .slip-amount { color: var(--muted); }
.slip-caption { margin: 0.1rem 0 1rem; font-size: 0.9375rem; color: var(--muted); }

.bar { display: flex; height: 1.1rem; border-radius: 0.3rem; overflow: hidden; background: #E3EBE5; }
.bar-you { background: var(--you); width: 0; transition: width 0.25s ease; }
.bar-match { background: var(--green-bright); width: 0; transition: width 0.25s ease; }

.lines { margin: 0.9rem 0 0; padding: 0.9rem 0 0; border-top: 2px dashed var(--line); display: grid; gap: 0.35rem; }
.lines div { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.lines dt { color: var(--muted); }
.lines dt::before { content: ""; display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; margin-right: 0.5rem; background: transparent; }
.lines .k-you dt::before { background: var(--you); }
.lines .k-match dt::before { background: var(--green-bright); }
.lines dd { margin: 0; font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines .total { border-top: 1px solid var(--line); padding-top: 0.4rem; margin-top: 0.2rem; }

.advice { margin: 1rem 0 0; padding: 0.8rem 0.95rem; background: var(--gold-wash); border-radius: 0.4rem; }
.math { margin-top: 0.9rem; }
.math ol { margin: 0.5rem 0; padding-left: 1.3rem; font-variant-numeric: tabular-nums; }
.math li { margin-bottom: 0.3rem; }
.fineprint { margin: 0.9rem 0 0; color: var(--muted); font-size: 0.8125rem; line-height: 1.4; }

/* Reading sections */
.doc { max-width: 44rem; margin: 3.5rem 0 0; }
.doc h2 { font-family: var(--display); font-size: clamp(1.5rem, 4.5vw, 2rem); line-height: 1.15; margin: 0 0 0.6rem; }
.doc h3 { font-size: 1.125rem; margin: 1.6rem 0 0.3rem; }
.doc p { margin: 0 0 0.8rem; }
.doc ul { margin: 0 0 0.8rem; padding-left: 1.2rem; }
.doc li { margin-bottom: 0.3rem; }

.table-wrap { overflow-x: auto; margin: 0.8rem 0 0.6rem; background: var(--surface); border-radius: 0.5rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); }
thead th { font-size: 0.9375rem; color: var(--muted); font-weight: 700; }
tbody th { font-weight: 400; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
td { font-family: var(--display); font-weight: 700; }
#credit td { font-family: var(--body); font-weight: 400; white-space: normal; }
#credit th { white-space: normal; }
#credit thead th:not(:first-child) { color: var(--ink); }
tr.is-current th, tr.is-current td { background: var(--gold-wash); }

.foot { max-width: 68rem; margin: 4rem auto 0; padding: 1.5rem 1.1rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.foot p { max-width: 44rem; margin: 0 0 0.6rem; }

/* Phone only: the answer stays in view while you type. */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.7rem 1.1rem calc(0.7rem + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff;
}
.dock[hidden] { display: none; }
.dock a { color: #fff; font: 700 1.5rem/1 var(--display); text-decoration: none; font-variant-numeric: tabular-nums; }

.page { max-width: 44rem; }
.page h1 { font-family: var(--display); font-size: clamp(1.75rem, 5vw, 2.5rem); line-height: 1.1; margin: 1rem 0 0.8rem; }
.page h2 { font-size: 1.125rem; margin: 1.6rem 0 0.3rem; }
.page p, .page ul { margin: 0 0 0.8rem; }

@media (min-width: 30rem) {
  .top-note .wide { display: inline; }
}

@media (min-width: 56rem) {
  body { padding-bottom: 2rem; }
  .tool { grid-template-columns: minmax(0, 1fr) minmax(20rem, 25rem); column-gap: 3rem; row-gap: 1.75rem; }
  .intro { grid-column: 1 / -1; }
  .slip { position: sticky; top: 1.25rem; padding: 1.7rem 1.6rem 1.3rem; }
  .dock { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar-you, .bar-match { transition: none; }
}
