/*
  PurePaycheck glue: what the live pages need beyond tokens.css + proto.css (copies of the prototype,
  work/design/concepts/b-deposit). Only tokens, no colour literal. Components stay in proto.css.
*/

/* A long answer must stay in the field: eight characters ("2,050.80") a touch smaller on the phone, nine and up
   (a yearly "54,407.60") smaller everywhere */
@container calc (max-width: 1099px) {
  .result__amount--wide {
    font-size: min(var(--fs-84), 20.5vw);
  }

  .result__amount--long {
    font-size: min(var(--fs-84), 17vw);
  }
}

@container calc (min-width: 1100px) {
  .result__amount--long {
    font-size: clamp(var(--fs-84), 11vw, calc(var(--fs-190) * 0.84));
  }
}

/* State taxes in the bar and the withheld rows: darker than the result field, the same in both themes */
:root {
  --color-bar-state: oklch(38% 0.16 300);
  --color-bar-payroll: oklch(28% 0.1 296);
}

.bar__seg--state {
  fill: var(--color-bar-state);
}

.bar__seg--payroll {
  fill: var(--color-bar-payroll);
}

.swatch--state {
  background: var(--color-bar-state);
}

.swatch--payroll {
  background: var(--color-bar-payroll);
}

/* The bar grows by one label step per tax shown (proto.css draws three) */
.bar--n1 {
  height: 88px;
}

.bar--n2 {
  height: 120px;
}

.bar--n4 {
  height: 184px;
}

.bar--n5 {
  height: 216px;
}

/* A visitor who came by a shared link sees the answer before the fields on the phone */
.calc--linked .calc__result {
  order: -1;
}

/* Clip, not hidden: rounded corners stay and the fields can stick on desktop */
.calc {
  overflow: clip;
}

/* "Who this models" closes the form, under the State field */
.fields__about {
  margin: var(--space-4) 0 0;
  font-size: var(--fs-15);
  line-height: 1.45;
  color: var(--color-text-2);
}

/* Tax-saved answer: the fold explains the figure; overtime-pay answer: three lines under the amount.
   The take-home block under the fold draws its own top rule. */
.result__fold {
  grid-area: figure;
  margin-top: var(--space-20);
  border-bottom: 0;
}

/* Cost-of-living answer: the three lines and the fold under them share the figure row */
.result__stack {
  grid-area: figure;
}

.result__lines {
  grid-area: figure;
  margin-top: var(--space-22);
  padding-top: var(--space-18);
  border-top: var(--line) solid var(--color-rule-on-accent);
}

/* Take-home as the second answer: the bar spans the block */
.deduction--takehome .bar {
  grid-area: auto;
  grid-column: 1 / -1;
  margin-top: var(--space-4);
}

/* A page without a contents list: the copy takes the full width */
.longread--single .longread__body {
  grid-column: 1 / -1;
}

@container calc (min-width: 1100px) {
  .calc--linked .calc__result {
    order: 0;
  }

  /* The answer runs long; the fields and the note stay in view beside it */
  .fields {
    position: sticky;
    top: var(--space-24);
  }

  .fields__about {
    margin-top: var(--space-10);
    font-size: var(--fs-16);
  }

  .result__fold {
    margin-top: var(--space-28);
  }

  .result__lines {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-40);
    margin-top: var(--space-30);
    padding-top: var(--space-24);
  }

  .bar--n1 {
    height: 114px;
  }

  .bar--n2 {
    height: 150px;
  }

  .bar--n4 {
    height: 222px;
  }

  .bar--n5 {
    height: 258px;
  }

  .bar__stem--4 {
    height: 141px;
  }

  .bar__stem--5 {
    height: 177px;
  }

  .bar__tick--4 {
    y: 203px;
  }

  .bar__tick--5 {
    y: 239px;
  }

  .bar__label--4 {
    transform: translateY(36px);
  }

  .bar__label--5 {
    transform: translateY(40px);
  }
}
