:root {
  --ink: #18302B;
  --muted: #546A64;
  --page: #E6EDEA;
  --paper: #FFFFFF;
  --line: #C3D2CD;
  --green: #0B7A55;
  --red: #B3261E;
  --tag: #F4C542;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 1rem/1.6 var(--sans); }
a { color: var(--green); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { background: var(--ink); color: #fff; }
.top-in { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font: 700 1.25rem/1 var(--display); letter-spacing: -.01em; }
.brand:hover { color: var(--tag); }
.top nav { display: flex; gap: 1.25rem; }
.top nav a { color: #DCE6E2; text-decoration: none; font-weight: 500; }
.top nav a:hover { color: #fff; text-decoration: underline; }

/* type */
h1, h2 { font-family: var(--display); letter-spacing: -.02em; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); max-width: 18ch; }
h2 { font-size: 1.6rem; margin: 2.5rem 0 .75rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 58ch; margin: 1rem 0 .5rem; }
.checked { font-size: .9rem; color: var(--muted); margin: 0 0 1.5rem; }
.crumbs { font-size: .9rem; color: var(--muted); padding-top: 1.5rem; margin-bottom: 1rem; }

/* calculator */
.calc { display: grid; grid-template-columns: 1fr minmax(300px, 380px); gap: 2rem; align-items: start; }
.inputs fieldset { border: 0; padding: 0; margin: 0 0 1.75rem; }
.inputs legend { font: 700 1.1rem/1 var(--display); margin-bottom: .75rem; padding: 0; }
.field { display: block; margin-bottom: 1rem; }
.field > span:first-child { display: block; font-weight: 500; margin-bottom: .3rem; }
.field small, .check small { display: block; color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.input { display: flex; align-items: stretch; background: var(--paper); border: 1.5px solid var(--line); border-radius: 8px; max-width: 280px; }
.input:focus-within { border-color: var(--ink); }
.input b { display: grid; place-items: center; padding: 0 .7rem; color: var(--muted); font-weight: 500; border-right: 1.5px solid var(--line); }
.input.percent { flex-direction: row-reverse; }
.input.percent b { border-right: 0; border-left: 1.5px solid var(--line); }
.input input { border: 0; background: transparent; font: 500 1.05rem var(--sans); color: var(--ink); padding: .6rem .7rem; width: 100%; min-width: 0; }
.input input:focus { outline: none; }
select { font: 500 1rem var(--sans); color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 8px; padding: .6rem .7rem; width: 100%; max-width: 420px; }
.check { display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; align-items: start; margin-bottom: .9rem; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; margin: .2rem 0 0; accent-color: var(--green); }
.check small { grid-column: 2; margin: 0; }

/* the receipt: the one memorable element */
.receipt {
  position: sticky; top: 1rem;
  background: var(--paper); font-family: var(--mono); font-size: .9rem;
  padding: 1.5rem 1.4rem 2.2rem; margin-bottom: 1rem;
  box-shadow: 0 1px 0 var(--line), 0 18px 30px -22px rgba(24, 48, 43, .55);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%;
}
.r-head { margin: 0 0 1rem; padding-bottom: .75rem; border-bottom: 2px dashed var(--line); font-weight: 600; text-align: center; }
.r-lines { list-style: none; margin: 0; padding: 0; }
.r-lines li { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; }
.r-lines li span:first-child { color: var(--muted); }
.r-lines li span:last-child { white-space: nowrap; }
.r-lines.fees li span:last-child { color: var(--red); }
.r-lines .sub { border-top: 1px dotted var(--line); }
.keep { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 1rem 0 .5rem; padding: .9rem 0; border-top: 2px dashed var(--line); border-bottom: 2px dashed var(--line); }
.keep span { font-weight: 600; }
.keep strong { font: 700 2.1rem/1 var(--display); color: var(--green); letter-spacing: -.02em; }
.keep strong.loss, .r-rank strong.loss { color: var(--red); }
.r-meta { color: var(--muted); font-size: .8rem; margin: .5rem 0; }
.r-goal { margin-top: 1rem; background: #FFF6D6; border-left: 4px solid var(--tag); padding: .6rem .8rem; }
.r-goal p { display: flex; justify-content: space-between; gap: 1rem; margin: .2rem 0; }
.reset { margin-top: 1rem; font: 500 .85rem var(--sans); color: var(--ink); background: none; border: 1.5px solid var(--line); border-radius: 6px; padding: .4rem .8rem; cursor: pointer; }
.reset:hover { border-color: var(--ink); }

/* home */
.hero { display: grid; grid-template-columns: 1fr minmax(300px, 400px); gap: 2.5rem; padding: 3rem 0 1rem; align-items: start; }
.compare-in { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin-top: 1.5rem; }
.compare-in .field { flex: 1 1 160px; max-width: 220px; }
.r-rank { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.r-rank li { counter-increment: rank; border-bottom: 1px dotted var(--line); }
.r-rank a { display: grid; grid-template-columns: 1.4rem 1fr auto auto; gap: .5rem; align-items: center; padding: .5rem .4rem; margin: 0 -.4rem; color: var(--ink); text-decoration: none; border-radius: 6px; }
.r-rank a::before { content: counter(rank); color: var(--muted); }
.r-rank a:hover { background: #EEF5F2; }
.r-rank .name { font-weight: 600; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.r-rank .fee { color: var(--red); font-size: .8rem; }
.r-rank strong { font-weight: 600; color: var(--green); }
.r-rank li:first-child strong { background: var(--tag); padding: 0 .3rem; }
.r-rank .go { grid-column: 2 / -1; justify-self: start; font: 500 .75rem var(--sans); color: var(--green); border: 1.5px solid var(--green); border-radius: 999px; padding: .05rem .55rem; }
.r-rank a:hover .go { background: var(--green); color: #fff; }

.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tiles a { display: flex; flex-direction: column; height: 100%; padding: 1rem 1rem 1.1rem; text-decoration: none; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 10px; }
.tiles strong { display: block; font: 700 1.25rem/1.2 var(--display); }
.tiles span { color: var(--muted); font-size: .9rem; margin: .25rem 0 .9rem; }
.tiles .btn { margin: auto 0 0; align-self: flex-start; color: #fff; font-size: .9rem; }
.tiles a:hover { border-color: var(--ink); }
.tiles a:hover .btn, .link-list a:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

.btn { display: inline-block; font: 600 .9rem var(--sans); color: #fff; background: var(--green); border: 1.5px solid var(--green); border-radius: 8px; padding: .45rem .9rem; }

/* article */
.prose { max-width: 68ch; }
.prose p { margin: 0 0 1rem; }
.page { padding: 2rem 0 1rem; }
.page h1 { margin-bottom: 1.5rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--paper); font-size: .95rem; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--ink); color: #fff; font-weight: 600; }
.source { font-size: .9rem; color: var(--muted); margin-top: .75rem; }
details { border-bottom: 1px solid var(--line); padding: .75rem 0; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: .6rem 0 0; }
.more { margin: 2rem 0 3rem; }
.link-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.link-list a { display: inline-block; text-decoration: none; color: var(--ink); font-weight: 600; background: var(--paper); border: 1.5px solid var(--line); border-radius: 8px; padding: .5rem .9rem; }

/* footer */
.foot { background: var(--ink); color: #C9D6D2; margin-top: 3rem; padding: 2rem 0; font-size: .9rem; }
.foot a { color: #fff; }
.foot nav { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: .75rem 0; }
.foot-brand { color: #fff; margin: 0; }
.fine { font-size: .8rem; max-width: 80ch; }

.mbar { display: none; }
@media (max-width: 820px) {
  .mbar { display: flex; align-items: baseline; gap: .6rem; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: .7rem 16px; background: var(--ink); color: #fff; text-decoration: none; font-weight: 500; box-shadow: 0 -6px 16px rgba(24,48,43,.25); }
  .mbar strong { font: 700 1.3rem/1 var(--display); color: #7FE0B8; }
  .mbar strong.loss { color: #FF9C94; }
  .mbar span { margin-left: auto; text-decoration: underline; font-size: .9rem; color: #DCE6E2; }
  body:has(.mbar) .foot { padding-bottom: 4.5rem; }
  .calc, .hero { grid-template-columns: 1fr; }
  .receipt { position: static; }
  .hero { padding-top: 2rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }
