/* The claim-vs-cash calculator's look on the KWDR site: the site palette and fonts,
   rounded panels, orange for the cash path and navy for the claim path. Restored from
   the 2026-09-05 page. Markup and logic come from website/drafts/claim-vs-cash-calculator.html
   through _tools/claim_calculator_build.py; this file is presentation only. The draft's own
   dark stylesheet is stripped on the way in, so the Artifact keeps its look and this one
   keeps the site's. Bump css_version in constants.json after editing. */

:root {
  color-scheme: light;

  /* Site palette. The tool keeps its own variable names so its 500 lines of
     layout are untouched; only what the names point at changed. */
  --ground: #ffffff;
  --surface: #ffffff;
  --sunk: #f4f7fb;
  --ink: #111827;
  --muted: #6b7280;
  --rule: #e5e9f0;
  --rule-hard: #d1d9e6;
  /* One colour per path, used nowhere else: blue is the claim, orange is
     cash. The UI chrome stays neutral so it never competes with them. */
  --claim: #1a3a6b;
  --claim-fill: #245bab;
  --cash: #e05a00;
  --cash-fill: #f07020;
  --alert: #b3261e;
  --alert-bg: #fdf0ec;
  --radius: 8px;
  /* Height of the site's pinned nav, kept current by the page script. The answer
     box pins just below it instead of sliding underneath. */
  --navh: 76px;
  --shadow: 0 2px 12px rgba(17,24,39,.08);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: 'Open Sans', system-ui, -apple-system, sans-serif;
  --display: 'Montserrat', system-ui, sans-serif;

  /* Three sizes. Everything else is weight and colour. */
  --t-body: 1rem;
  --t-small: .875rem;
  --t-micro: .75rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.calc-shell { padding: 2rem 0 3rem; }

/* A quieter banner than the site's photo hero, so the tool leads the page.
   This file loads on the calculator page only, so the override stays here. */
.page-hero {
  background: var(--sunk);
  border-bottom: 1px solid var(--rule-hard);
  padding: 2.25rem 1.25rem 2rem;
}
.page-hero h1 { color: var(--claim); font-size: clamp(1.6rem, 3.6vw, 2.1rem); margin-bottom: .5rem; }
.page-hero p { color: #4b5563; font-size: 1rem; }

/* Two price fields side by side get too narrow for the figures on a phone. */
@media (max-width: 26rem) {
  .pair { grid-template-columns: 1fr; }
}

/* ---------- two registers ----------
   .panel is something you operate: raised, bordered, always open.
   .accordion is what you read: collapsed until you want it. */

.panel {
  background: var(--surface);
  border: 1px solid var(--rule-hard);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.35rem 1.4rem;
  display: flex; flex-direction: column; gap: .85rem;
}
.panel > header {
  display: flex; align-items: baseline; gap: .55rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule);
}
.calc-shell h2 {   /* scoped: a bare h2 rule would shrink the CTA heading below the tool */
  margin: 0;
  font-family: var(--display);
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  flex: 1 1 auto;
}
.sub {
  font-family: var(--display);
  font-size: var(--t-micro);
  color: var(--muted);
  letter-spacing: .04em;
  white-space: nowrap;
  flex: 0 0 auto;
}

.note { margin: 0; font-size: var(--t-small); color: var(--muted); max-width: 48ch; }
.note strong { color: var(--ink); font-weight: 600; }
.body { margin: 0; font-size: var(--t-body); max-width: 46ch; }
.body strong { font-weight: 600; }

.divider {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--display); font-size: var(--t-micro);
  letter-spacing: .11em; text-transform: uppercase; color: var(--muted);
  margin-top: .15rem;
}
.divider::after { content: ""; height: 1px; background: var(--rule); flex: 1 1 auto; }

.sectionbreak {
  display: flex; align-items: center; gap: .6rem;
  scroll-margin-top: 1rem;
  font-family: var(--display); font-size: var(--t-micro); font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
  margin-top: 1.1rem;
}
.sectionbreak::after { content: ""; height: 2px; background: var(--rule-hard); flex: 1 1 auto; }

/* ---------- money fields: one treatment everywhere ---------- */

.field { display: flex; flex-direction: column; gap: .3rem; }
.field > label, .flabel {
  font-size: var(--t-body); line-height: 1.3; font-weight: 500;
}
.field .hint {
  display: block; font-size: var(--t-small); font-weight: 400;
  color: var(--muted); line-height: 1.35; margin-top: .12rem;
}

.money {
  display: flex; align-items: center; gap: .3rem;
  background: var(--sunk);
  border: 1px solid var(--rule-hard);
  border-radius: var(--radius);
  padding: 0 .8rem;
  min-height: 3.1rem;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.money .cur { font-family: var(--display); font-size: 1.125rem; color: var(--muted); }
.money input {
  flex: 1 1 auto; width: 100%;
  border: none; background: transparent; color: var(--ink);
  font-family: var(--mono);
  font-size: 1.375rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  text-align: right;
  padding: .35rem 0;
  min-width: 0;
}
.money input::placeholder { color: var(--rule-hard); }
.money input:focus { outline: none; }
.money:focus-within {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.pricecard:not(.claimside) .money:focus-within {
  border-color: var(--cash); box-shadow: inset 0 0 0 1px var(--cash);
}
.claimside .money:focus-within {
  border-color: var(--claim); box-shadow: inset 0 0 0 1px var(--claim);
}

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.pricecard { display: flex; flex-direction: column; gap: .35rem; }
.pricecard .pl {
  font-family: var(--display); font-size: var(--t-micro);
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink); font-weight: 700;
}
.pricecard .pl { color: var(--cash); }
.pricecard.claimside .pl { color: var(--claim); }
.pricecard .ph { font-size: var(--t-small); line-height: 1.3; color: var(--muted); flex: 1 1 auto; }
.pricecard .money input { font-size: 1.5rem; }

.stack { display: flex; flex-direction: column; gap: .75rem; }

/* ---------- segmented control ---------- */

.ask { margin: 0; font-size: var(--t-body); font-weight: 600; max-width: 42ch; }
.qlabel { font-size: var(--t-body); font-weight: 500; max-width: 42ch; }

.seg { display: flex; }
.seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.seg button {
  flex: 1 1 0;
  font-family: var(--display); font-size: var(--t-micro);
  letter-spacing: .04em;
  color: var(--ink); background: var(--sunk);
  border: 1px solid var(--rule-hard); border-right: none;
  padding: .5rem .4rem;
  min-height: 2.75rem;
  cursor: pointer;
  transition: background .12s ease;
}
.seg button:last-child { border-right: 1px solid var(--rule-hard); }
.seg button:hover { background: var(--rule); }
/* Each control is coloured by the path it moves: the scope question
   qualifies the cash bid, the prior-claims question drives the claim's
   surcharge. Nothing interactive is left neutral. */
.seg button[aria-pressed="true"] {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.seg button[data-scope][aria-pressed="true"] {
  background: var(--cash); border-color: var(--cash);
}
.seg button[data-prior][aria-pressed="true"] {
  background: var(--claim-fill); border-color: var(--claim-fill);
}
button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}

/* ---------- sliders ---------- */

.sliders { display: flex; flex-direction: column; gap: .9rem; }
.slider { display: flex; flex-direction: column; gap: .3rem; }
.slabel {
  display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
  font-family: var(--display); font-size: var(--t-micro);
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.slabel .sval {
  font-size: 1.125rem; letter-spacing: -.02em; text-transform: none;
  color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums;
}
/* A prior claim moves this rate for you. Flag it until you take it over. */
.slabel .sval.auto { color: var(--alert); }
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 2.75rem; margin: 0;
  background: transparent; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: .375rem; border: 1px solid var(--rule-hard); border-radius: 99px;
  background: linear-gradient(to right, var(--claim-fill) var(--fill, 0%), var(--sunk) var(--fill, 0%));
}
input[type=range]::-moz-range-track {
  height: .375rem; border: 1px solid var(--rule-hard); border-radius: 99px;
  background: linear-gradient(to right, var(--claim-fill) var(--fill, 0%), var(--sunk) var(--fill, 0%));
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 1.5rem; height: 1.5rem; margin-top: -.5rem; border-radius: 50%;
  background: var(--claim-fill); border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(17,24,39,.25);
}
input[type=range]::-moz-range-thumb {
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--claim-fill); border: 2px solid var(--surface);
}

.calcline {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .75rem; border-top: 2px solid var(--claim); padding-top: .6rem;
  font-family: var(--mono);
}
.calcline .k { font-size: var(--t-micro); letter-spacing: .11em; text-transform: uppercase; }
.calcline .v {
  font-size: 1.5rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.03em;
}
/* The total is what feeds the comparison; the yearly figure is what they feel. */
.calcsub {
  margin: .1rem 0 0; text-align: right;
  font-family: var(--sans); font-size: var(--t-micro);
  font-variant-numeric: tabular-nums; color: var(--muted);
}

/* ---------- alerts: expand in place, no layout jump ---------- */

.alert {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .22s ease, opacity .22s ease, margin-bottom .22s ease;
  opacity: 0; margin-bottom: -.75rem;
  background: var(--alert-bg);
  border-left: 3px solid var(--alert);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.alert > div { overflow: hidden; }
.alert > div > .pad { padding: .7rem .85rem; font-size: var(--t-small); }
.alert.on { grid-template-rows: 1fr; opacity: 1; margin-bottom: 0; }
.alert b {
  display: block;
  font-family: var(--display); font-size: var(--t-micro);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--alert); margin-bottom: .25rem;
}
.alert.soft { background: var(--sunk); border-left-color: var(--rule-hard); }
.alert.soft b { color: var(--muted); }

.flagchip {
  font-family: var(--display); font-size: var(--t-micro);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--alert); border: 1px solid var(--alert);
  border-radius: 99px; padding: .2rem .6rem; display: none;
  white-space: nowrap; line-height: 1.2;
}
.flagchip.on { display: inline-block; }
/* In the answer box the badge wraps under the path name. Give it room on both
   sides so it does not sit on the name above or the bar below. */
.ptop .pn .flagchip {
  font-size: .6875rem; letter-spacing: .08em;
  margin: .4rem 0 .45rem;
}

/* ---------- the reading half: four topics, opened on demand ---------- */

.accordion {
  border: 1px solid var(--rule-hard);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  background: var(--surface);
}
details.acc + details.acc { border-top: 1px solid var(--rule); }
details.acc > summary { list-style: none; cursor: pointer; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::marker { content: ""; }
.acc-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .25rem .75rem;
  padding: .85rem 1rem;
  min-height: 3.25rem;
}
.acc-t {
  font-family: var(--display); font-size: var(--t-micro); font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase;
}
.acc-s {
  grid-column: 1; font-size: var(--t-small); color: var(--muted); line-height: 1.35;
}
.acc-c {
  grid-column: 2; grid-row: 1 / span 2; align-self: center;
  width: .55rem; height: .55rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .18s ease;
}
details.acc[open] .acc-head { background: var(--sunk); }
details.acc[open] .acc-c { transform: rotate(-135deg); }
details.acc[open] .acc-s { display: none; }
details.acc[open] .acc-c { grid-row: 1; }
details.acc > .acc-body { display: none; }
details.acc[open] > .acc-body {
  padding: .9rem 1rem 1.05rem;
  display: flex; flex-direction: column; gap: .7rem;
  border-top: 1px solid var(--rule);
}

/* ---------- reference content ---------- */

dl.terms { margin: 0; font-size: var(--t-body); }
dl.terms dt {
  font-family: var(--display); font-size: var(--t-micro); letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink); font-weight: 700;
  margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--rule);
}
dl.terms dt:first-child { margin-top: 0; padding-top: 0; border-top: none; }
dl.terms dd { margin: .25rem 0 0; max-width: 46ch; color: var(--muted); font-size: var(--t-small); }

table.scope { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
table.scope th, table.scope td {
  text-align: left; padding: .5rem; vertical-align: top;
  border-bottom: 1px solid var(--rule);
}
table.scope th {
  font-family: var(--display); font-size: var(--t-micro); letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); font-weight: 400;
  border-bottom: 1px solid var(--rule-hard);
}
table.scope th:nth-child(2) { color: var(--cash); }
table.scope th:last-child { color: var(--claim); }
table.scope tr:last-child td { border-bottom: none; }
table.scope th:first-child, table.scope td:first-child {
  width: 28%; padding-left: 0;
  font-family: var(--display); font-size: var(--t-micro);
  letter-spacing: .04em; color: var(--muted);
}
table.scope td:last-child { background: var(--sunk); }
table.scope .win { margin-right: .25rem; }
table.scope td:has(.win) { color: var(--ink); font-weight: 600; }

/* Below 480px the table stops being a table and becomes stacked cards.
   Covers every phone, including the 430px Pro Max sizes. */
@media (max-width: 30rem) {
  table.scope, table.scope tbody, table.scope tr, table.scope td { display: block; width: auto; }
  table.scope thead { display: none; }
  table.scope tr {
    border: 1px solid var(--rule); padding: .55rem .65rem; margin-bottom: .4rem;
  }
  table.scope td { border: none; padding: .1rem 0; }
  table.scope td:first-child {
    width: auto; font-size: var(--t-micro); text-transform: uppercase;
    letter-spacing: .09em; color: var(--muted); margin-bottom: .2rem;
  }
  table.scope td:not(:first-child)::before {
    font-family: var(--display); font-size: var(--t-micro);
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); margin-right: .4rem;
  }
  table.scope td:nth-child(2)::before { content: "Cash"; color: var(--cash); }
  table.scope td:nth-child(3)::before { content: "Claim"; color: var(--claim); }
  table.scope td:last-child { background: transparent; }
}

ol.asks { margin: 0; padding-left: 1.35rem; font-size: var(--t-body); }
ol.asks li { margin-bottom: .4rem; padding-left: .15rem; }
ol.asks li::marker { font-family: var(--display); font-size: var(--t-small); color: var(--muted); }

/* ---------- the answer ---------- */

/* The result sits above its inputs and follows you down the page. Being at the
   top keeps it clear of the phone keyboard and leaves the page foot reachable. */
input, summary, button, .panel, .accordion { scroll-margin-top: calc(var(--navh) + var(--barh, 6rem) + .75rem); }

.verdict {
  position: sticky; top: var(--navh); z-index: 9;
  background: var(--surface);
  border-top: 1px solid var(--rule-hard);
  border-bottom: 1px solid var(--rule-hard);
  box-shadow: 0 6px 18px rgba(17,24,39,.10);
}
.verdict .inner {
  max-width: 34rem; margin: 0 auto;
  padding: .15rem 1rem .7rem;
  display: flex; flex-direction: column; gap: .4rem;
}

.vbar {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  width: 100%; min-height: 2.75rem;
  margin: 0 -.25rem; padding: 0 .25rem;
  background: none; border: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.vsum {
  font-family: var(--mono); font-size: 1.0625rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  color: var(--cash);   /* the cash total is bare text; the claim total and label carry classes */
}
.vsum .c { color: var(--claim); }
.vsum .lbl { font-size: var(--t-micro); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.vchev {
  width: .55rem; height: .55rem; flex: 0 0 auto;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-135deg); transition: transform .18s ease;
}
.verdict.open .vchev { transform: rotate(45deg); }

.paths { display: none; flex-direction: column; gap: .55rem; }
.verdict.open .paths { display: flex; }


.path {
  display: flex; flex-direction: column; gap: .22rem;
  padding: .35rem .5rem; margin: 0 -.5rem;
  transition: background .15s ease;
}
.path.lit { background: var(--sunk); }
.ptop { display: flex; align-items: baseline; gap: .4rem; }
.ptop .pn {
  font-family: var(--display); font-size: var(--t-micro); font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase; flex: 1 1 auto; min-width: 0;
}
/* The chip wraps under the name if it has to; "costs you" never breaks. */
.ptop .pk {
  font-family: var(--display); font-size: var(--t-micro);
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; flex: 0 0 auto;
}
.ptop .pt {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 1.375rem; font-weight: 700; letter-spacing: -.03em;
  min-width: 5rem; text-align: right;
}
.path:not(.claim) .pt, .path:not(.claim) .pn { color: var(--cash); }
.path.claim .pt, .path.claim .pn { color: var(--claim); }
.track { display: flex; height: .6rem; background: var(--sunk); border: 1px solid var(--rule); border-radius: 99px; overflow: hidden; }
.track i { display: block; height: 100%; transition: width .18s ease-out; }
.track .a { background: var(--cash-fill); }
.track .b { background: var(--claim-fill); }
.track .later { background: var(--claim-fill); opacity: .34; }
.pd {
  font-family: var(--sans); font-size: var(--t-micro);
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.pd b { color: var(--ink); font-weight: 700; }

.readout {
  font-size: var(--t-body); color: var(--muted); line-height: 1.35;
  border-top: 1px solid var(--rule); padding-top: .45rem;
  min-height: 3.15em;
}
.readout b { color: var(--ink); font-weight: 700; }
.readout.warn, .readout.warn b { color: var(--alert); }

/* ---------- actions + footer ---------- */

.actions { display: flex; flex-direction: column; gap: .5rem; }
.actions button {
  font-family: var(--display); font-size: var(--t-micro);
  letter-spacing: .06em; text-transform: uppercase;
  padding: .8rem .5rem; min-height: 2.75rem;
  background: var(--sunk); color: var(--ink);
  border: 1px solid var(--rule-hard);
  border-radius: var(--radius);
  cursor: pointer;
}
.actions button:hover { background: var(--rule); }
.actions .primary {
  background: var(--ink); color: #fff; border-color: var(--ink);
  font-size: var(--t-small); letter-spacing: .08em;
  min-height: 3.25rem;
}
.actions .primary:hover { background: #24509a; border-color: #24509a; }
.actions .primary[disabled] {
  background: var(--sunk); color: var(--muted); border-color: var(--rule-hard);
  cursor: default;
}
.actions .minor { display: flex; gap: .5rem; }
.actions .minor button { flex: 1 1 0; color: var(--muted); }

footer.fine {
  font-size: var(--t-small); color: var(--muted);
  border-top: 1px solid var(--rule);
  padding: .8rem 0 1.5rem; max-width: 54ch;
}
footer.fine strong { color: var(--ink); }

/* ---------- desktop: the answer becomes a sidebar ---------- */

@media (min-width: 62rem) {
  /* The grid lives on the tool's own wrapper, not on <body>: the site nav
     and footer are body children and would otherwise auto-place into it. */
  .calc-shell {
    display: grid;
    grid-template-columns: minmax(0, 34rem) 21rem;
    grid-template-rows: 1fr;
    justify-content: center;
    align-items: start;
    column-gap: 2rem;
    padding: 2.5rem 2rem 4rem;   /* the gap between the banner and the tool */
  }
  .wrap { grid-column: 1; grid-row: 1; max-width: none; padding: 0 0 2rem; }
  .verdict {
    grid-column: 2; grid-row: 1;
    align-self: start;
    top: calc(var(--navh) + 1.5rem); margin-top: 0;   /* level with the first panel */
    border: 1px solid var(--rule-hard);
    border-top: 1px solid var(--rule-hard);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .verdict .inner { max-width: none; padding: .15rem 1rem 1rem; }
  .vbar { display: none; }   /* the phone's tap-to-open bar; on desktop the box is always open */
  .vchev, .vsum { display: none; }
  .paths { display: flex; padding-top: .9rem; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media print {
  body { background: #fff; color: #000; }
  .calc-shell { display: block; }
  .verdict { position: static; box-shadow: none; border: 1px solid #999; }
  .wrap { max-width: none; }
  .paths { display: flex !important; }
  .vbar, .actions { display: none; }
  details.acc > .acc-body { display: block !important; }
  .alert { grid-template-rows: 1fr; opacity: 1; }
  .panel, .acc-body, table.scope tr { break-inside: avoid; }
  .sectionbreak, .divider { break-after: avoid; }
}
