/* Will a Raise Cost Me? — shares the paper and type of the other Money apps.
 * Three hues, one per tax: copper for payroll (FICA), the deep green accent for
 * federal income tax, slate for California. */
:root {
  --paper: #f4f1e8; --card: #fbf9f3; --ink: #1d2420; --ink-2: #4c5650;
  --ink-3: #87908a; --rule: rgba(29,36,32,.18); --rule-soft: rgba(29,36,32,.09);
  --accent: #2f5d46;
  --accent-2: #b0662a;
  --state: #5b7290;
  --serif: "Fraunces", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --side-w: 330px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: calc(var(--appnav-h, 0px) + 20px); }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); max-width: 1680px; margin: 0 auto; }
.side {
  position: sticky; top: var(--appnav-h, 0px);
  height: calc(100vh - var(--appnav-h, 0px)); height: calc(100dvh - var(--appnav-h, 0px));
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  border-right: 1px solid var(--rule-soft);
}
.side-inner { padding: 1.2rem 1.15rem 1.4rem 1.3rem; }
.kicker, .cap-k, .controls legend, .controls label, .readout .k {
  font-family: var(--mono); font-size: .66rem; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
}
h1 {
  font-family: var(--serif); font-weight: 600; font-size: 2.15rem; line-height: 1.05;
  letter-spacing: -.01em; margin: .3rem 0 .6rem; font-variation-settings: "opsz" 96;
}
h1 em { font-style: italic; color: var(--accent); }
.lede { font-size: 15px; color: var(--ink-2); }
.lede em { font-style: italic; }

/* ---------- controls ---------- */
.controls { margin-top: 1rem; display: grid; gap: .85rem; }
.field { border: 0; min-width: 0; }
.controls legend, .controls label { display: block; margin-bottom: .3rem; }
.hint-inline { text-transform: none; letter-spacing: 0; }
.money-row { display: flex; gap: .5rem; align-items: center; }
.money-row input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.money {
  width: 7.2rem; flex: none; padding: .32rem .5rem; text-align: right;
  font-family: var(--mono); font-size: .9rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 6px;
}
.money-row .money:only-child { width: 9rem; }
.chip {
  flex: 1; padding: .34rem .6rem; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--card); cursor: pointer; font-size: .85rem; text-align: center;
}
.chip[aria-pressed=true] { background: var(--accent); color: #fff; border-color: var(--accent); }
.seg { display: flex; border: 1px solid var(--rule); border-radius: 7px; overflow: hidden; background: var(--card); }
.seg button {
  flex: 1; padding: .36rem .3rem; border: 0; background: none; cursor: pointer;
  font-size: .82rem; line-height: 1.2; border-left: 1px solid var(--rule-soft);
}
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed=true] { background: var(--accent); color: #fff; }
.seg-sub { margin-top: .4rem; }
.hint { font-size: .78rem; color: var(--ink-3); margin-top: .2rem; }

/* ---------- readout ---------- */
.readout { margin-top: .9rem; padding: .8rem 0 .9rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.big { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.big > div { display: flex; flex-direction: column; }
.big .v { font-family: var(--serif); font-weight: 600; font-size: 1.9rem; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.big .s { font-size: .78rem; color: var(--ink-2); line-height: 1.35; }
.raise { margin-top: .75rem; font-size: 15px; }
.raise b { font-family: var(--mono); font-weight: 500; font-size: .92em; }
.side-foot { margin-top: 1rem; font-size: .8rem; color: var(--ink-3); }

/* ---------- charts ---------- */
.main { min-width: 0; }
.charts {
  display: grid; grid-template-rows: 1.45fr 1fr; gap: .4rem;
  height: calc(100vh - var(--appnav-h, 0px)); height: calc(100dvh - var(--appnav-h, 0px));
  min-height: 560px; padding: .9rem 1.2rem .6rem;
}
.chart { display: flex; flex-direction: column; min-height: 0; }
figcaption { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.cap-k { color: var(--accent); }
.cap-t { font-size: .86rem; color: var(--ink-2); }
.svg-box { position: relative; flex: 1; min-height: 0; }
.svg-box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .8rem; color: var(--ink-2); }
.legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; vertical-align: -.1rem; margin-right: .3rem; }
.legend i.line { height: 3px; vertical-align: .2rem; border-radius: 0; }
.legend i.dash { height: 0; border-top: 2px dashed currentColor; background: none !important; vertical-align: .25rem; }

svg text { font-family: var(--mono); font-size: 11px; fill: var(--ink-3); }
svg .axis line, svg .grid line { stroke: var(--rule-soft); }
svg .axis path { stroke: var(--rule); }
svg .lbl { fill: var(--ink); font-size: 11px; }
svg .lbl-strong { fill: var(--ink); font-size: 12px; font-weight: 500; }
svg .lbl, svg .lbl-strong { paint-order: stroke; stroke: var(--paper); stroke-width: 3.5px; stroke-linejoin: round; }
svg .on-dark { fill: #fff; }
svg .you { stroke: var(--ink); stroke-width: 1.5; }
svg .probe { stroke: var(--ink-3); stroke-dasharray: 3 3; }
svg .ghost { fill: none; stroke-width: 1; }
svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.tip {
  position: absolute; pointer-events: none; z-index: 3; max-width: 270px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 7px;
  padding: .45rem .6rem; font-size: .8rem; line-height: 1.4; box-shadow: 0 4px 14px rgba(29,36,32,.12);
}
.tip b { font-family: var(--mono); font-weight: 500; }
.tip .row { display: flex; justify-content: space-between; gap: .8rem; }

/* ---------- details & prose ---------- */
.details, .prose { padding: 1.6rem 1.5rem 0; max-width: 1100px; }
.details h2, .prose h2 { font-family: var(--serif); font-weight: 600; font-size: 1.45rem; margin-bottom: .7rem; }
.details h3 { font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin-bottom: .4rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.2rem 2rem; }
.ledger { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ledger td, .ledger th { padding: .28rem 0; border-bottom: 1px solid var(--rule-soft); text-align: left; font-weight: 400; vertical-align: top; }
.ledger td.n, .ledger th.n { text-align: right; font-family: var(--mono); font-size: .85rem; white-space: nowrap; padding-left: .8rem; }
.ledger tr.sub td { color: var(--ink-2); padding-left: .8rem; }
.ledger tr.total td { font-weight: 600; border-bottom: 1px solid var(--rule); }
.ledger tr.chosen td { color: var(--accent); font-weight: 600; }
.ledger .sw { display: inline-block; width: .6rem; height: .6rem; border-radius: 2px; margin-right: .4rem; }
.note { font-size: .85rem; color: var(--ink-2); margin-top: .5rem; }
.prose p, .prose li { max-width: 72ch; }
.prose p + p, .prose ul + p { margin-top: .7rem; }
.prose ul { padding-left: 1.2rem; margin-top: .5rem; }
.prose li { margin-bottom: .45rem; }
.prose code { font-family: var(--mono); font-size: .85em; }
.refs li { font-size: .92rem; }
.changelog { padding-bottom: 3rem; }
.changelog ul { list-style: none; padding: 0; }
.changelog time { font-family: var(--mono); font-size: .8rem; color: var(--ink-3); margin-right: .7rem; }

/* ---------- narrow ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .side-inner { padding: 1rem 16px 1.2rem; }
  .charts { height: auto; min-height: 0; grid-template-rows: none; padding: .8rem 16px 0; gap: 1rem; }
  .svg-box { flex: none; height: 360px; }
  #curve-box { height: 260px; }
  .details, .prose { padding: 1.4rem 16px 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .seg button, .chip { transition: background-color .15s, color .15s; }
}
