/* Calculator, article and info pages. Colours, type, header, buttons and
   footer come from base.css. */
:root { --warn: #7A4400; --warnbg: #FCEBC8; }
h1 { font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.2rem); line-height: 1.08; margin: 0 0 14px; }
h2 { font-size: clamp(1.45rem, 1.2rem + 0.9vw, 1.85rem); line-height: 1.2; margin: 44px 0 14px; }
h3 { font-size: 1.15rem; margin: 22px 0 8px; }
p { margin: 0 0 14px; }

/* ---------- row of calculators ---------- */
.tools { border-bottom: 1px solid var(--line); background: var(--white); }
.tools nav { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0; scrollbar-width: thin; }
.tools a { flex: none; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.tools a:first-child { margin-left: auto; }
.tools a:last-child { margin-right: auto; }
.tools a:hover { color: var(--ink); border-color: var(--green); }
.tools a[aria-current="page"] { background: var(--forest); border-color: var(--forest); color: var(--cream); }
/* nine calculators do not fit one line: wrap on wide screens, swipe on small ones */
@media (min-width: 801px) {
  .tools nav { flex-wrap: wrap; justify-content: center; }
  .tools a:first-child { margin-left: 0; }
  .tools a:last-child { margin-right: 0; }
}

/* ---------- title band ---------- */
.masthead { position: relative; overflow: hidden; text-align: center; padding: 46px 0 78px; background:
  linear-gradient(180deg, transparent 55%, var(--paper) 98%),
  radial-gradient(45% 90% at 85% 10%, rgb(240 178 74 / 0.36), transparent 70%),
  radial-gradient(45% 90% at 10% 20%, rgb(159 216 182 / 0.5), transparent 70%),
  repeating-linear-gradient(90deg, rgb(255 255 255 / 0.65) 0 1px, transparent 1px 14px), var(--paper); }
.masthead .col { position: relative; }
.masthead h1 { max-width: 20ch; margin-inline: auto; }
.lead { font-size: 19px; color: var(--muted); max-width: 36em; margin: 0 auto; }
.col { width: min(840px, 100% - 32px); margin-inline: auto; }
main > .col { padding-bottom: 64px; }
/* the first box lifts into the title band */
main > .col > .card:first-child { position: relative; margin-top: -40px; box-shadow: var(--shadow-lg); }
main > .col > :first-child:not(.card) { padding-top: 34px; margin-top: 0; }

/* ---------- boxes and forms ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 24px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
label.f { display: block; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
label.f > select, label.f .money { margin-top: 5px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
input, select { font: 500 16px var(--mono); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
.money { display: flex; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding-left: 12px; }
.money > span { color: var(--muted); font-family: var(--mono); }
.money input { border: 0; background: transparent; padding-left: 5px; }
.money:focus-within { outline: 3px solid var(--amber); outline-offset: 1px; }
.money input:focus-visible { outline: 0; }
.money.pctf { flex-direction: row-reverse; padding-left: 0; padding-right: 12px; }
.debts input[data-k="n"], select { font-family: var(--text); }
button { font: 600 15px var(--text); border-radius: 999px; padding: 10px 18px; cursor: pointer; border: 1px solid var(--forest); background: var(--forest); color: var(--cream); transition: transform 120ms var(--ease), background-color 150ms; }
button:active { transform: translateY(1px); }
button.ghost { background: transparent; color: var(--ink); border-color: rgb(14 25 20 / 0.28); }
button.ghost:hover { background: var(--paper-2); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 6px; vertical-align: middle; font-variant-numeric: tabular-nums; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
.debts td:last-child { width: 1%; }
.debts button.x { padding: 8px 12px; font-size: 14px; background: transparent; color: var(--muted); border-color: var(--line); }

/* ---------- results ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--paper-2); border-radius: 14px; padding: 15px 16px; }
.tile .k { font-size: 13px; font-weight: 600; color: var(--muted); }
.tile .v { font: 500 27px/1.25 var(--mono); letter-spacing: -0.04em; }
.tile .s { font-size: 13px; color: var(--muted); }
.tiles .tile:first-child { background: var(--forest); color: var(--cream); }
.tiles .tile:first-child .k, .tiles .tile:first-child .s { color: var(--sage); }
.tiles .tile:first-child .v { color: var(--amber); }
.warn { background: var(--warnbg); color: var(--warn); border-radius: 12px; padding: 11px 14px; margin: 0 0 14px; }
ol.order { padding-left: 22px; margin: 0 0 14px; }
.more td, .more th, table.nums th, table.nums td { border-bottom: 1px solid var(--line); }
ul.cmp { list-style: none; padding: 0; margin: 8px 0 0; }
ul.cmp li { padding: 10px 12px; border-radius: 10px; margin-bottom: 6px; background: var(--paper-2); }
ul.cmp li.off { background: var(--warnbg); color: var(--warn); }
.scroll { overflow-x: auto; margin: 0 0 18px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; }
.scroll table.nums tr:last-child > * { border-bottom: 0; }
table.nums { font-size: 14.5px; }
table.nums th, table.nums td { padding: 10px 6px; vertical-align: top; }
table.nums thead th { font-size: 12.5px; }
table.nums tbody th { color: var(--ink); font-size: 14.5px; }
main li { margin-bottom: 5px; }

/* ---------- the app box ---------- */
.cta { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 26px; align-items: center; margin: 40px 0; border-radius: 24px; padding: 32px 0 32px 32px; overflow: hidden; color: var(--cream); box-shadow: var(--shadow-lg); background:
  radial-gradient(60% 90% at 100% 100%, rgb(240 178 74 / 0.35), transparent 70%), var(--forest); }
.cta h2 { margin: 0 0 10px; }
.cta p, .cta li { color: var(--cream); font-size: 15.5px; }
.cta ul { list-style: none; margin: 0 0 18px; padding: 0; }
.cta li { display: flex; gap: 11px; align-items: baseline; }
.cta li::before { content: ""; flex: none; width: 6px; height: 11px; border: solid var(--amber); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.cta .btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cta .fine { margin: 12px 0 0; font-size: 13px; color: var(--sage); }
.cta__shot img { width: 230px; margin: 0 auto; border: 6px solid #000; border-bottom-width: 6px; border-radius: 26px; box-shadow: var(--shadow-lg); }
.cta__shot { align-self: stretch; display: flex; align-items: flex-start; justify-content: center; height: 330px; overflow: hidden; margin-bottom: -32px; padding-right: 24px; }

/* ---------- lists, questions ---------- */
.links { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.links a { display: block; height: 100%; background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 13px 16px; text-decoration: none; color: var(--ink); font-weight: 600; }
.links a::after { content: " \2192"; color: var(--green); }
.links a:hover { border-color: var(--green); }
details { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 13px 18px; margin-bottom: 10px; }
summary { font-weight: 600; cursor: pointer; }
details p { margin: 10px 0 0; color: var(--muted); }
.post h2 { margin-top: 0; font-size: 1.4rem; }
.post h2 a { color: var(--ink); text-decoration: none; }
.post h2 a:hover { color: var(--green); }

@media (max-width: 640px) {
  .fields, .tiles, .links, .cta { grid-template-columns: 1fr; }
  .masthead { padding: 32px 0 64px; }
  .card { padding: 18px; }
  .tools a:first-child { margin-left: 0; }
  .cta { padding: 24px 20px 0; gap: 20px; }
  .cta .btns .btn { width: 100%; }
  .cta__shot { height: 240px; margin-bottom: 0; padding-right: 0; }
  .debts thead { display: none; }
  .debts tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .debts td { padding: 0; }
  .debts td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
  .debts td:first-child { grid-column: 1 / -1; }
  .debts td:last-child { width: auto; align-self: end; }
}

/* ---------- shop page ---------- */
.shop { width: min(1160px, 100% - 32px); margin-inline: auto; padding-bottom: 64px; }
.shop img { width: 100%; max-width: 550px; margin-inline: auto; border-radius: 14px; background: var(--forest); }
.feature { position: relative; margin-top: -40px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: center; box-shadow: var(--shadow-lg); }
.feature h2 { margin: 0 0 8px; }
.cost { font: 600 32px/1.2 var(--display); margin: 0 0 12px; }
.cost small { font: 500 13.5px var(--text); color: var(--muted); margin-left: 8px; }
.save { background: var(--amber-soft); border-radius: 12px; padding: 11px 14px; }
.products { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.item { display: flex; flex-direction: column; padding: 12px 12px 16px; margin: 0; border-radius: 18px; }
.item img { margin-bottom: 12px; }
.item h3 { margin: 0 4px 6px; line-height: 1.25; }
.item p { margin: 0 4px 10px; font-size: 14.5px; }
.item .cost { font-size: 25px; }
.item .cost small { display: block; margin-left: 0; }
.item p.small { font-size: 13px; }
.item .btn { margin-top: auto; }
.item h3 a, .feature h2 a { color: inherit; text-decoration: none; }
.item h3 a:hover, .feature h2 a:hover { text-decoration: underline; }
.more-link { display: block; text-align: center; font-size: 14px; font-weight: 500; padding: 10px 4px 0; }
.shop .foot-note { margin-top: 32px; max-width: 52em; }

@media (max-width: 1000px) {
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .feature { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 560px) {
  .products { grid-template-columns: minmax(0, 1fr); }
}
/* very large amounts wrap inside their box instead of widening the page */
.tiles > .tile { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 360px) { .tiles > .tile { padding-inline: 10px; } .tiles > .tile .v { font-size: 21px; } }
