/* Cushion free tools: calculator styles. Loaded after tools/blog.css (a copy of the
   blog's stylesheet), so the nav, footer, post cards and tokens match the blog.

   One rule per kind of thing, so every tool looks like one piece:
   - layout is flat: a full-width band for the calculator, thin dividers, no cards;
   - headings are sentence case, no small caps labels;
   - on/off is a switch, a choice between options is a row of underlined tabs;
   - numbers go in plain boxes (10px corners); buttons keep the site's green pill;
   - colour: Cushion green for anything active or selected (switch, tab, focus, slider,
     share hover) and the button; band colours only for the band; grey only for quiet text. */

/* ---------- header ---------- */
.tool-head { padding: 20px var(--gutter) 28px; max-width: 980px; }
.tool-head .display { margin-top: 0; font-size: 30px; }
.tool-head .lede { margin-top: 12px; font-size: 16px; line-height: 24px; max-width: 600px; }
@media (min-width: 640px) { .tool-head { padding-block: 32px 36px; } .tool-head .display { font-size: 40px; } }
@media (min-width: 1024px) { .tool-head .display { font-size: 46px; } }

/* ---------- the calculator band ---------- */
.bench { background: var(--surface-1); border-block: 1px solid var(--line); }
.calc { display: grid; grid-template-columns: minmax(0, 1fr); padding-block: 28px 32px; }
.calc__out { margin-top: 28px; padding-top: 28px; border-top: 1px solid rgba(43, 138, 0, .14); }
@media (min-width: 900px) {
  .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-block: 44px 48px; }
  .calc__in { padding-right: 48px; }
  .calc__out { margin-top: 0; padding: 0 0 0 48px; border-top: 0; border-left: 1px solid rgba(43, 138, 0, .14); }
}
.calc__head, .r__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 28px; margin-bottom: 22px; }
.calc__title, .r__title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.02em; color: var(--heading); }

/* ---------- fields ---------- */
.fld + .fld { margin-top: 24px; }
.fld__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; min-height: 28px; margin-bottom: 8px; }
.fld__head > [hidden] { display: none; }
.fld__label { font-size: 15px; font-weight: 600; color: var(--heading); }
.fld__label small { font-size: 13px; font-weight: 500; color: var(--faint); }
.fld__row { display: flex; gap: 10px; }
.fld__row > * { flex: 1 1 0; min-width: 0; }
.fld__row > [hidden] { display: none; }

/* number boxes */
.box { display: flex; align-items: center; gap: 6px; height: 52px; padding: 0 14px; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; cursor: text; transition: border-color .15s, box-shadow .15s; }
.box:hover { border-color: #a9d68f; }
.box:focus-within { border-color: var(--green-ink); box-shadow: 0 0 0 3px rgba(85, 255, 0, .22); }
.box.is-bad { border-color: #d42f2f; }
.box__tag { font-size: 13px; font-weight: 500; color: var(--muted); }
.box__sym, .box__suffix { font-size: 16px; font-weight: 600; color: var(--muted); }
.box input { flex: 1; width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 17px; font-weight: 600; color: var(--heading); }
/* phones: a labelled box stacks its label small on top and the number below, so long labels
   ("Freight and duty") never squeeze the number. The £ is dropped; the label says what it is. */
@media (max-width: 599px) {
  .box--tagged { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; padding: 0 12px; }
  .box--tagged .box__tag { font-size: 11.5px; line-height: 14px; }
  .box--tagged .box__sym { display: none; }
  .box--tagged input, .box--tagged .box__suffix { flex: 0 0 auto; font-size: 16px; line-height: 20px; }
  .box--tagged .box__suffix { display: none; }
}

/* month-end grid */
.series { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .series { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.box--cell { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; height: 54px; padding: 0 10px; }
.box--cell .box__tag { font-size: 11.5px; line-height: 14px; }
.box--cell input { flex: 0 0 auto; font-size: 15px; line-height: 20px; }
.box--cell input::placeholder { color: var(--line-strong); }

/* a choice between options: underlined tabs */
.opts { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.opts button { padding: 3px 0; border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: color .15s, border-color .15s; }
.opts button:hover { color: var(--green-ink); }
.opts button[aria-pressed="true"] { color: var(--green-ink); border-bottom-color: var(--green); }

/* on/off: a switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; flex: 0 0 auto; width: 36px; height: 20px; border-radius: 99px; background: var(--line-strong); transition: background .2s var(--ease); }
.switch__track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 16, .25); transition: transform .2s var(--ease); }
.switch input:checked + .switch__track { background: var(--green-ink); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--green-ink); outline-offset: 2px; }
.switch__label { font-size: 14px; font-weight: 600; color: var(--heading); }
.fld__head .switch__label { font-size: 13.5px; color: var(--muted); }

.more { margin-top: 24px; padding-top: 24px; border-top: 1px solid rgba(43, 138, 0, .14); }
.more[hidden] { display: none; }

/* ---------- result ---------- */
.r__share { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: color .15s; }
.r__share:hover { color: var(--green-ink); }
.r__big { display: flex; align-items: baseline; gap: 10px; margin: 0; color: var(--heading); }
.r__big b { font-size: clamp(64px, 9vw, 88px); line-height: .95; font-weight: 800; letter-spacing: -.05em; }
.r__big span { font-size: 20px; font-weight: 600; color: var(--muted); }
.is-empty .r__big b { color: var(--line-strong); }
.r__band { margin: 14px 0 0; font-size: 15px; color: var(--body); }
.r__band i { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; vertical-align: 1px; background: var(--tone); }
.r__band strong { font-weight: 700; color: var(--heading); }
.r__error { margin: 14px 0 0; font-size: 15px; font-weight: 600; color: #b42318; }

[data-tone="green"] { --tone: #3fc400; }
[data-tone="lime"] { --tone: #a6e22e; }
[data-tone="amber"] { --tone: #f5a300; }
[data-tone="orange"] { --tone: #f2711c; }
[data-tone="red"] { --tone: #e5484d; }

.scale { margin-top: 22px; }
.scale__bar { position: relative; display: flex; gap: 3px; height: 6px; }
/* every band shows its colour; the one holding the marker is full strength, the rest dimmed */
.scale__bar i { height: 100%; border-radius: 99px; background: var(--tone); opacity: .24; transition: opacity .2s, transform .2s; }
.scale__bar i.on { opacity: 1; transform: scaleY(1.35); box-shadow: 0 2px 10px -2px var(--tone); }
.scale__dot { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--heading); transition: left .25s var(--ease); }
.scale__ticks { position: relative; height: 16px; margin-top: 8px; font-size: 11.5px; color: var(--faint); }
.scale__ticks span { position: absolute; transform: translateX(-50%); }
.scale__ticks span:first-child { transform: none; }
.scale__ticks span:last-child { transform: translateX(-100%); }

.r__free { margin: 18px 0 0; font-size: 15px; color: var(--body); }
.r__free strong { color: var(--heading); }

.r__stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: 22px 0 0; padding: 16px 0; border-block: 1px solid rgba(43, 138, 0, .14); }
.r__stats > div { padding: 0 14px; }
.r__stats > div:first-child { padding-left: 0; }
.r__stats > div + div { border-left: 1px solid var(--line); }
.r__stats dt { font-size: 13px; font-weight: 500; color: var(--muted); }
.r__stats dd { margin: 4px 0 0; font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--heading); }
.r__stats dd.sub { margin-top: 2px; font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--faint); }
@media (max-width: 420px) { .r__stats > div { padding: 0 8px; } .r__stats dd { font-size: 15px; } }
.r__line { margin: 14px 0 0; font-size: 15px; color: var(--body); }
.r__line b { color: var(--heading); }
.r__line[hidden] { display: none; }

.r__target { margin-top: 20px; }
.r__target-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; font-weight: 600; color: var(--heading); }
.r__target output { font-weight: 700; }
.r__target p { margin: 8px 0 0; font-size: 15px; color: var(--body); }
.r__target p b { color: var(--green-ink); font-weight: 700; }
.r__target input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; margin: 16px 0 6px; border-radius: 99px; outline-offset: 6px;
  background: linear-gradient(90deg, #3fc400 var(--fill, 50%), #d9ead0 var(--fill, 50%)); }
.r__target input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--green-ink); cursor: grab; }
.r__target input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--green-ink); cursor: grab; }
.r__target input[type=range]:disabled::-webkit-slider-thumb { cursor: default; }
/* the link to the next tool, under the result (reorder point to stock order) */
.r__next { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; color: var(--body); }
.r__next a { color: var(--green-ink); font-weight: 600; text-underline-offset: 3px; }
.r__next small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--faint); }
.r__note { margin: 18px 0 0; font-size: 12.5px; color: var(--faint); }

/* locked extras: not drawn at all until unlocked, so nothing peeks out around the form */
.lock { position: relative; }
.lock[hidden] { display: none; }
.lock.is-locked .lock__body { display: none; }
.gate { display: flex; flex-direction: column; align-items: flex-start; margin-top: 22px; padding-top: 22px; border-top: 1px solid rgba(43, 138, 0, .14); }
.gate[hidden] { display: none; }
.gate__title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 18px; line-height: 1.3; font-weight: 700; letter-spacing: -.02em; color: var(--heading); }
.gate__title svg { flex: 0 0 auto; color: var(--green-ink); }
.gate__text { margin: 6px 0 0; max-width: 440px; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.gate__row { display: flex; gap: 8px; width: 100%; max-width: 460px; margin-top: 16px; }
.gate__row input { flex: 1 1 auto; min-width: 0; height: 48px; padding: 0 14px; font: inherit; font-size: 16px; font-weight: 500; color: var(--heading); background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; outline: 0; transition: border-color .15s, box-shadow .15s; }
.gate__row input:focus { border-color: var(--green-ink); box-shadow: 0 0 0 3px rgba(85, 255, 0, .22); }
.gate__row input.is-bad { border-color: #d42f2f; }
.gate__row .btn { min-height: 48px; padding: 0 22px; font-size: 15px; white-space: nowrap; }
.gate__row .btn[disabled] { opacity: .6; cursor: default; transform: none; }
@media (max-width: 420px) { .gate__row { flex-direction: column; } }
.gate__msg { margin: 8px 0 0; font-size: 13.5px; font-weight: 600; color: #b42318; }
.gate__msg:empty { display: none; }
.gate__fine { margin-top: 8px; font-size: 12px; color: var(--faint); }
.gate__fine a { text-decoration: underline; }
.r__unlocked { margin: 14px 0 0; font-size: 13.5px; font-weight: 600; color: var(--green-ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- how it works ---------- */
.how { max-width: 760px; margin: 80px auto 0; padding-inline: var(--gutter); }
.how__h { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -.03em; color: var(--heading); }
@media (min-width: 640px) { .how__h { font-size: 32px; } }
.how__h--sub { margin-top: 64px; font-size: 24px; }
@media (min-width: 640px) { .how__h--sub { font-size: 26px; } }
.how__lede { margin: 12px 0 0; font-size: 16px; line-height: 1.65; color: var(--muted); }

.formula { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 14px; margin: 28px 0 0; padding: 22px 0; border-block: 1px solid var(--line); }
.formula__t { display: inline-flex; flex-direction: column; }
.formula__t b { font-size: 19px; font-weight: 700; letter-spacing: -.02em; color: var(--heading); }
.formula__t:first-child b { color: var(--green-ink); }
.formula__t small { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.formula__op { font-size: 20px; font-weight: 500; line-height: 28px; color: var(--faint); }

.acc { margin-top: 28px; border-top: 1px solid var(--line); }
.how__h + .acc { margin-top: 20px; }
.acc details { border-bottom: 1px solid var(--line); }
.acc summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 2px; font-size: 16.5px; font-weight: 600; color: var(--heading); }
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: ''; flex: 0 0 auto; width: 9px; height: 9px; margin-right: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s var(--ease); }
.acc details[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.acc summary:hover { color: var(--green-ink); }
.acc__body { padding: 0 2px 20px; font-size: 16px; line-height: 1.7; color: var(--body); }
.acc__body p { margin: 0 0 12px; }
.acc__body p:last-child, .acc__body ul:last-child { margin-bottom: 0; }
.acc__body ul { margin: 0 0 12px; padding-left: 20px; }
.acc__body li { margin-bottom: 8px; }
.acc__body li::marker { color: #3fc400; }
.acc__body strong { color: var(--heading); }

.ex { width: 100%; border-collapse: collapse; font-size: 15px; }
.ex td { padding: 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.ex tr:last-child td { border-bottom: 0; }
.ex td:last-child { padding-left: 12px; text-align: right; font-weight: 700; color: var(--heading); white-space: nowrap; }

.tool-related { margin-top: 0; margin-bottom: 96px; }
.tool-related .how__h--sub { margin-bottom: 24px; }

/* ---------- phones: result bar pinned to the bottom while the inputs are on screen ---------- */
.rbar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px 10px 16px; border-radius: 14px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); box-shadow: var(--shadow-float); text-align: left; color: var(--heading);
  transform: translateY(calc(100% + 24px)); opacity: 0; pointer-events: none; transition: transform .25s var(--ease), opacity .2s; }
.rbar.is-on { transform: none; opacity: 1; pointer-events: auto; }
.rbar__k { font-size: 13px; font-weight: 600; color: var(--muted); }
.rbar__v { margin-left: auto; white-space: nowrap; }
.rbar__v b { font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.rbar__v span { font-size: 14px; font-weight: 600; color: var(--muted); }
.rbar__band { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--body); white-space: nowrap; }
.rbar__band i { width: 8px; height: 8px; border-radius: 50%; background: var(--tone, var(--line-strong)); }
.rbar__go { flex: 0 0 auto; color: var(--muted); }
@media (min-width: 900px) { .rbar { display: none; } }
@media (max-width: 359px) { .rbar__k { display: none; } }

/* ---------- result lines, timeline chart and levers (stock order tool) ---------- */
.r__line p { margin: 0; }
.r__line p + p { margin-top: 6px; }

.chart { margin: 22px 0 0; }
.chart__svg { display: block; overflow: visible; font-family: var(--font); }
.chart__neg { fill: #fdeceb; }
.chart__cush { fill: #fff6e0; }
.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__zero { stroke: #c9cec4; }
.chart__ylab, .chart__xlab { font-size: 11px; fill: var(--faint); }
.chart__cushline { stroke: #f5a300; stroke-width: 1; stroke-dasharray: 4 4; }
.chart__cushlab { font-size: 11px; font-weight: 600; fill: #b87700; }
.chart__span { fill: rgba(43, 138, 0, .07); }
.chart__spanlab { font-size: 11px; font-weight: 600; fill: var(--green-ink); }
.chart__level { stroke: var(--heading); stroke-width: 1; stroke-dasharray: 5 4; opacity: .55; }
.chart__levellab { font-size: 11px; font-weight: 600; fill: var(--heading); paint-order: stroke; stroke: var(--surface-1); stroke-width: 4px; stroke-linejoin: round; }
.chart__area { fill: rgba(85, 255, 0, .1); }
.chart__line { fill: none; stroke: var(--green-ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart__low { fill: #fff; stroke: var(--heading); stroke-width: 2; }
.chart__lowlab { font-size: 12px; font-weight: 700; fill: var(--heading); paint-order: stroke; stroke: var(--surface-1); stroke-width: 4px; stroke-linejoin: round; }

.lev { width: 100%; margin-top: 20px; border-collapse: collapse; font-size: 14px; }
.lev caption { text-align: left; margin-bottom: 6px; font-size: 15px; font-weight: 600; color: var(--heading); }
.lev th { padding: 6px 0; border-bottom: 1px solid rgba(43, 138, 0, .14); text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.lev td { padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--body); }
.lev th + th, .lev td + td { text-align: right; padding-left: 10px; white-space: nowrap; }
.lev td:nth-child(2) { font-weight: 600; color: var(--heading); }
.lev td.up { color: var(--green-ink); font-weight: 600; }
.lev td.down { color: #c4320a; font-weight: 600; }
.lev tr:last-child td { border-bottom: 0; }
.lev tr.on td { color: var(--heading); font-weight: 600; }
.box__tagunit { display: none; }
@media (max-width: 599px) { .box--tagged .box__tagunit { display: inline; } }
.r__big { flex-wrap: wrap; row-gap: 4px; }
.r__big span { white-space: nowrap; }
.r__big.is-long b { font-size: clamp(46px, 7vw, 72px); }

/* the formula line breaks out of the text column on wider screens so it stays on one line */
@media (min-width: 900px) {
  .formula { position: relative; left: 50%; width: min(1000px, calc(100vw - 2 * var(--gutter))); transform: translateX(-50%);
    flex-wrap: nowrap; justify-content: center; gap: 10px 22px; }
  .formula__t { flex: 0 0 auto; text-align: center; }
}

/* locked chart: a blurred decoy chart (no real figures) fills the panel behind the unlock form.
   The decoy is stretched to the panel, blurred hard and veiled evenly, so it reads as "a chart
   is waiting here" without competing with the words on top. */
.lock__teaser { display: none; }
.lock.is-locked > .lock__teaser { display: block; position: absolute; inset: 22px 0 0; overflow: hidden; pointer-events: none; user-select: none; }
.lock__teaser svg { display: block; width: 100%; height: 100%; filter: blur(4px); }
.lock__teaser::after { content: ''; position: absolute; inset: 0; background: rgba(250, 251, 249, .4); }
.lock__teaser + .gate { position: relative; z-index: 1; min-height: 300px; margin-top: 22px; padding: 36px 20px; border-top: 0;
  align-items: center; justify-content: center; text-align: center; }
.lock__teaser + .gate .gate__title { display: block; max-width: 380px; margin-inline: auto; text-wrap: balance; }
.lock__teaser + .gate .gate__title svg { display: inline-block; vertical-align: -2px; margin-right: 6px; }
.lock__teaser + .gate .gate__text { max-width: 380px; margin-inline: auto; color: var(--body); text-wrap: balance; }
.lock__teaser + .gate .gate__row { margin-inline: auto; }
.lock__teaser + .gate .gate__fine { color: var(--muted); }
.chart__svg--bare .chart__line, .chart__svg--bare line { vector-effect: non-scaling-stroke; }
.chart__svg--bare .chart__line { stroke-width: 4; }

/* the locked preview of a tool with a full example chart (reorder point): lighter blur, so it reads as a real chart */
.lock__teaser--full svg { filter: blur(2.5px); }
.lock__teaser--full::after { background: rgba(250, 251, 249, .3); }

/* free figures under the bar (reorder point), the colour dot matching its part of the bar */
.r__stats--free { margin-top: 18px; }
.r__stats--free dt i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--tone); vertical-align: 1px; }
