/* The free tools (bill, rent and trip splitters) and the guide pages built by site/pages/build.mjs */

.page-hero { padding-block: calc(var(--section) * 0.7) calc(var(--section) * 0.4); }
.page-hero h1 { font: var(--display-weight) clamp(36px, 6vw, 64px)/1.04 var(--font-display); letter-spacing: var(--display-tracking-xl); }
.crumbs { display: flex; gap: var(--s-2); font-size: var(--t-small); color: var(--muted); margin-bottom: var(--s-4); }
.crumbs a { color: inherit; }

/* the calculator */
.tool { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-6); padding: clamp(20px, 4vw, 36px); border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); }
@media (min-width: 900px) { .tool { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; } }
.tool__in { display: grid; gap: var(--s-4); }
.tool__row { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.tool .field :is(input, select) { width: 100%; background: var(--bg); }
.tool fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: var(--s-3); }
.tool legend { font-size: var(--t-small); font-weight: 600; margin-bottom: var(--s-2); }
.lines { display: grid; gap: var(--s-2); }
.line { display: grid; gap: var(--s-2); grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: center; }
.line--3 { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 0.9fr) auto; }
.line input, .line select { width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--ink); font: inherit; }
.line__x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer; }
.line__x:hover { color: var(--ink); border-color: var(--line-strong); }
.add { justify-self: start; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px dashed var(--line-strong);
  background: transparent; color: var(--ink); font: 500 var(--t-small) var(--font-text); cursor: pointer; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); justify-self: start; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; padding: 8px 14px; border-radius: 999px; font-size: var(--t-small); font-weight: 500; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: var(--bg); }
.seg input:focus-visible + span { outline: 2px solid var(--action); outline-offset: 2px; }

/* the answer */
.tool__out { display: grid; gap: var(--s-4); padding: clamp(18px, 3vw, 28px); border-radius: var(--r-md); background: var(--bg);
  border: 1px solid var(--line); position: sticky; top: 88px; }
.tool__big { font: 600 clamp(32px, 5vw, 48px)/1.05 var(--font-display); letter-spacing: var(--display-tracking); font-variant-numeric: tabular-nums; }
.tool__note { color: var(--muted); font-size: var(--t-small); line-height: 1.5; }
.tool__list { list-style: none; margin: 0; padding: 0; display: grid; }
.tool__list li { display: flex; justify-content: space-between; gap: var(--s-3); padding: 10px 0; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums; }
.tool__list li:last-child { border-bottom: 0; }
.tool__list b { font-weight: 600; white-space: nowrap; }
.tool__cta { display: grid; gap: var(--s-2); padding-top: var(--s-2); }

/* guide text */
.prose { display: grid; gap: var(--s-4); max-width: 68ch; font-size: var(--t-body); line-height: 1.65; }
.prose h2 { font: var(--display-weight) clamp(26px, 3.4vw, 36px)/1.15 var(--font-display); letter-spacing: var(--display-tracking); margin-top: var(--s-5); }
.prose h3 { font: 600 var(--t-lead)/1.35 var(--font-text); margin-top: var(--s-3); }
.prose ul, .prose ol { padding-left: 1.2em; display: grid; gap: var(--s-2); }
.compare { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
.compare th, .compare td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare thead th { font-weight: 600; }
.compare td:first-child { color: var(--muted); }
.compare__wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px 12px; background: var(--bg); }

/* more tools */
.cards-3 { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tcard { display: grid; gap: var(--s-2); padding: var(--s-5); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); text-decoration: none; }
.tcard:hover { border-color: var(--line-strong); }
.tcard b { font: 600 var(--t-lead)/1.3 var(--font-text); }
.tcard span { color: var(--muted); font-size: var(--t-small); line-height: 1.5; }

/* phones: an expense row puts "what for" on its own line, then who paid, the amount and remove */
@media (max-width: 560px) {
  .line--3 { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) auto; }
  .line--3 > input:first-child { grid-column: 1 / -1; }
  .line--3 + .line--3 { margin-top: var(--s-2); }
}

/* these pages are reading pages: each section is as tall as what's in it, not a screen each */
main > .section.section, footer.closing.closing { height: auto; min-height: 0; }
main > .section.section + .section { padding-top: 0; }
.prose ol { list-style: decimal; }
.prose ul { list-style: disc; }
.legal-links { display: inline-flex; gap: var(--s-4); }
