/* SAVINGS CALCULATOR: sliders left, a till printing the year's receipt right */
.calc {
  position: relative; padding-block: clamp(48px, 7vh, 84px); overflow: clip;
  background:
    radial-gradient(42% 60% at 78% 46%, rgba(166, 210, 43, .16), transparent 70%),
    radial-gradient(30% 40% at 6% 92%, rgba(11, 143, 227, .08), transparent 70%),
    var(--sky);
}
.calc__bg { position: absolute; inset: 0; pointer-events: none; }
/* a faint till-roll ruling behind the till */
.calc__roll {
  position: absolute; right: 4%; top: -10%; bottom: -10%; width: min(38vw, 560px);
  background: repeating-linear-gradient(180deg, rgba(18, 26, 58, .045) 0 1px, transparent 1px 34px);
  -webkit-mask: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent);
  mask: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent);
}
.calc__grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 430px); gap: clamp(40px, 5.5vw, 96px); align-items: center; }

/* left: heading, rows, CTA */
.calc__head { display: grid; gap: 14px; margin-bottom: clamp(22px, 3vh, 34px); }
.calc__rows { display: grid; gap: 12px; margin: 0; }
.calc__row {
  margin: 0; min-width: 0; border: 0; padding: 16px 22px 14px;
  display: grid; grid-template-columns: minmax(250px, 1.12fr) minmax(0, 1fr) minmax(0, 1fr); gap: 4px 26px; align-items: center;
  background: var(--paper); border-radius: var(--r); box-shadow: 0 1px 0 rgba(18, 26, 58, .05), 0 18px 34px -30px rgba(18, 26, 58, .5);
  transition: box-shadow .4s var(--ease);
}
.calc__row:focus-within { box-shadow: 0 0 0 2px var(--ink), 0 18px 34px -26px rgba(18, 26, 58, .55); }
.calc__label { display: flex; align-items: center; gap: 14px; }
.calc__label strong { display: block; font-family: var(--display); font-weight: 700; font-size: 1.16rem; line-height: 1.15; letter-spacing: -.01em; }
.calc__label small { display: block; font-size: .9rem; color: var(--grey); line-height: 1.3; margin-top: 2px; }
.calc__ico { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--sky); color: var(--ink); }
.calc__ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.calc__row:focus-within .calc__ico { background: var(--lime); }

.calc__ctl { min-width: 0; }
.calc__ctl label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .92rem; font-weight: 600; color: #3a4266; line-height: 1.2; }
.calc__ctl output { font-family: var(--display); font-weight: 700; font-size: 1.22rem; color: var(--ink); display: inline-block; min-width: 2.4ch; text-align: right; }

/* range: brand track, ink thumb, 44px tall to tap */
.rng { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; --p: 50%; }
.rng:focus { outline: none; }
.rng::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--lime), var(--lime-deep)) 0 0 / var(--p) 100% no-repeat, var(--sky-2);
}
.rng::-moz-range-track { height: 8px; border-radius: 999px; background: var(--sky-2); }
.rng::-moz-range-progress { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--lime), var(--lime-deep)); }
.rng::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%;
  background: var(--ink); border: 5px solid var(--paper); box-shadow: 0 0 0 2px var(--ink), 0 8px 16px -6px rgba(18, 26, 58, .6);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.rng::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--ink); border: 5px solid var(--paper); box-shadow: 0 0 0 2px var(--ink), 0 8px 16px -6px rgba(18, 26, 58, .6); }
.rng:hover::-webkit-slider-thumb { transform: scale(1.12); }
.rng:active::-webkit-slider-thumb { transform: scale(1.2); }
.rng:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--ink), 0 0 0 6px var(--blue); }
.rng:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--ink), 0 0 0 6px var(--blue); }

.calc__foot { margin-top: clamp(20px, 3vh, 30px); display: grid; gap: 12px; }
.calc__price { font-size: 1rem; color: #3a4266; }
.calc__price strong { font-family: var(--display); font-size: 1.2rem; color: var(--ink); }
.calc__avg { font-size: .95rem; color: var(--grey); }
.calc__avg strong { color: var(--ink); }
.calc__mini { display: none; }

/* right: the till */
.till { position: relative; margin: 0; width: 100%; max-width: 430px; justify-self: center; display: flex; flex-direction: column; align-items: center; }
.till__head {
  position: relative; z-index: 2; width: 100%; height: 80px; padding: 0 20px 12px; display: flex; align-items: center; gap: 16px;
  background: linear-gradient(180deg, var(--ink-3), var(--ink) 70%); color: var(--paper); border-radius: var(--r);
  box-shadow: 0 30px 50px -30px rgba(18, 26, 58, .7), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.till__led { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(166, 210, 43, .18), 0 0 14px 2px rgba(166, 210, 43, .7); animation: tillBlink 2.4s steps(1, end) infinite; }
.till.is-printing .till__led { animation-duration: .35s; background: var(--orange); box-shadow: 0 0 0 4px rgba(244, 160, 28, .2), 0 0 14px 2px rgba(244, 160, 28, .8); }
@keyframes tillBlink { 0%, 70% { opacity: 1; } 71%, 100% { opacity: .35; } }
.till__screen {
  flex: 1; min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 14px; border-radius: var(--r-sm);
  background: linear-gradient(180deg, #0b1130, #141d45); box-shadow: inset 0 2px 8px rgba(0, 0, 0, .5), 0 0 0 1px rgba(166, 210, 43, .18);
}
.till__screen small { font-size: .875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgba(214, 238, 156, .75); }
.till__screen b { font-family: var(--display); font-weight: 700; font-size: 1.6rem; line-height: 1; color: var(--lime); text-shadow: 0 0 12px rgba(166, 210, 43, .55); }
.till__keys { flex: none; display: grid; grid-template-columns: repeat(3, 9px); gap: 5px; }
.till__keys i { width: 9px; height: 9px; border-radius: 2px; background: rgba(255, 255, 255, .16); }
.till__keys i:nth-child(5) { background: var(--orange); }
.till__slot { position: absolute; left: 7%; right: 7%; bottom: 7px; height: 6px; border-radius: 999px; background: #050820; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .8), 0 1px 0 rgba(255, 255, 255, .1); }

/* the receipt comes out of the slot: the mouth clips only its top edge */
.till__mouth { position: relative; z-index: 1; width: 86%; margin-top: -10px; clip-path: inset(0 -80px -140px -80px); }
.till__feed { will-change: transform; }
.till__sway { position: relative; transform-origin: 50% 0; }
.receipt {
  position: relative; padding: 20px 22px 24px; background: var(--paper); color: var(--ink); border-radius: var(--r-sm);
  font-variant-numeric: tabular-nums; transform-origin: 50% 0;
  box-shadow: 0 1px 0 rgba(18, 26, 58, .06), 0 34px 40px -34px rgba(18, 26, 58, .55);
  background-image: linear-gradient(180deg, rgba(18, 26, 58, .07), transparent 22px);
  /* torn zigzag foot */
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 9px) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 18px 9px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 9px) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 18px 9px repeat-x;
}
.receipt__top { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 2px dashed var(--line); }
.receipt__top img { width: 42px; height: auto; flex: none; }
.receipt__top strong { display: block; font-family: var(--display); font-weight: 700; font-size: 1.08rem; line-height: 1.2; }
.receipt__top span { display: block; font-size: .875rem; color: var(--grey); }
.receipt__lines { list-style: none; margin: 0; padding: 8px 0 4px; display: grid; gap: 4px; }
.receipt__lines li { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; padding: 3px 8px 5px; margin: 0 -8px; border-radius: var(--r-sm); }
.receipt__item { font-weight: 700; font-size: .98rem; line-height: 1.25; }
.receipt__item small { display: block; font-weight: 500; font-size: .875rem; color: var(--grey); }
.receipt__lines b, .receipt__row b, .receipt__total b { font-family: var(--display); font-weight: 700; font-size: 1.08rem; display: inline-block; }
.receipt__bar { grid-column: 1 / -1; height: 4px; background: var(--sky-2); border-radius: 999px; overflow: hidden; }
.receipt__bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--lime), var(--lime-deep)); transform-origin: left; transform: scaleX(var(--w, 0)); transition: transform .7s var(--ease); }
.receipt__lines li.is-flash::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(166, 210, 43, .22); animation: lineFlash .9s var(--ease) forwards; }
@keyframes lineFlash { from { opacity: 1; } to { opacity: 0; } }
.receipt__total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 4px; padding: 8px 0 4px; border-top: 2px dashed var(--line); font-weight: 700; }
.receipt__total b { font-size: 1.55rem; letter-spacing: -.01em; }
.receipt__row { display: flex; justify-content: space-between; gap: 12px; font-size: .98rem; color: #3a4266; padding: 0; line-height: 1.5; }
.receipt__row--keep { color: var(--ink); font-weight: 700; }
.receipt__row--keep b { font-size: 1.3rem; color: var(--blue-text); }
.receipt__pay { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 12px; align-items: center; margin-top: 8px; padding-top: 10px; border-top: 2px dashed var(--line); }
.receipt__paycol { min-width: 0; }
.receipt__spot { position: relative; width: 112px; aspect-ratio: 1; margin: -4px 0 -6px; }
.receipt__spot::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 2px dashed var(--line); }
.receipt__paytext { display: grid; gap: 1px; line-height: 1.25; margin-bottom: 8px; min-height: 2.6em; }
.receipt__pay strong { font-family: var(--display); font-size: 1.12rem; font-weight: 700; }
.receipt__pay [data-pay-sub] { font-size: .875rem; color: var(--grey); }
.receipt__weeks { display: grid; grid-template-columns: repeat(52, 1fr); gap: 2px; height: 16px; }
.receipt__weeks i { background: #d9e0ec; border-radius: 1px; transition: background-color .3s var(--ease), transform .3s var(--ease); transition-delay: calc(var(--i) * 6ms); transform-origin: bottom; }
.receipt__weeks i.is-pay { background: var(--ink); transform: scaleY(.7); }
.receipt__weeks i.is-save { background: var(--lime-deep); }
.receipt__wk { display: flex; justify-content: space-between; font-size: .875rem; color: var(--grey); margin-top: 3px; }
.receipt__code { display: block; width: 100%; height: 22px; margin-top: 10px; fill: var(--ink); opacity: .85; }
.receipt__small { margin-top: 6px; font-size: .875rem; line-height: 1.4; color: var(--grey); text-align: center; }

/* the rubber stamp */
.stamp { position: absolute; z-index: 3; left: -6px; top: -10px; width: 130px; aspect-ratio: 1; color: var(--blue-text); transform: rotate(-14deg); pointer-events: none; opacity: 0; }
.stamp.is-on { opacity: .9; }
.stamp svg { width: 100%; height: 100%; overflow: visible; }
.stamp__ring { font-family: var(--body); font-weight: 800; font-size: 17px; letter-spacing: .16em; fill: currentColor; }
.stamp__big { font-family: var(--display); font-weight: 800; font-size: 27px; letter-spacing: .02em; fill: #fff; }
.stamp::after { content: ""; position: absolute; inset: 6%; border-radius: 50%; border: 3px solid currentColor; opacity: 0; transform: scale(1); }
.stamp.is-splat::after { animation: stampRing .6s var(--ease); }
@keyframes stampRing { 0% { opacity: .5; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.6); } }

/* tablets and small laptops: the label sits above its two sliders */
@media (max-width: 1280px) {
  .calc__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 14px 20px 10px; }
  .calc__label { grid-column: 1 / -1; }
  .calc__ico { width: 40px; height: 40px; }
  .calc__grid { grid-template-columns: minmax(0, 1fr) minmax(330px, 390px); gap: 40px; }
  .receipt { padding: 22px 20px 26px; }
}
@media (max-width: 900px) {
  .calc { padding-block: 72px 64px; }
  .calc__grid { grid-template-columns: minmax(0, 1fr); gap: 44px; }
  .till { max-width: 420px; }
  .calc__mini.is-live {
    position: fixed; left: 16px; right: 16px; bottom: 12px; z-index: 40; display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap;
    min-height: 56px; padding: 10px 56px 10px 18px; background: var(--ink); color: var(--paper); text-decoration: none; border-radius: var(--r-sm);
    box-shadow: 0 18px 30px -16px rgba(18, 26, 58, .6), 0 0 0 1px rgba(255, 255, 255, .06); font-size: .95rem; line-height: 1.3;
    visibility: hidden; opacity: 0; transform: translateY(140%);
  }
  .calc__mini strong { font-family: var(--display); font-size: 1.15rem; color: var(--lime); }
  .calc__mini [data-mini-pay] { color: #c9d1ea; }
  .calc__mini i { position: absolute; right: 8px; top: 50%; width: 40px; height: 40px; margin-top: -20px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: var(--ink); font-style: normal; font-weight: 700; }
}
@media (max-width: 560px) {
  .calc__row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 14px 16px 6px; }
  .calc__label { margin-bottom: 6px; }
  .calc__price { flex-basis: 100%; }
  .till__head { height: 84px; padding: 0 16px 12px; gap: 12px; }
  .till__keys { display: none; }
  .till__screen b { font-size: 1.4rem; }
  .till__mouth { width: 90%; }
  .receipt { padding: 20px 16px 26px; }
  .receipt__pay { grid-template-columns: minmax(0, 1fr) 100px; gap: 8px; }
  .receipt__spot { width: 100px; }
  .stamp { width: 116px; left: -6px; top: -8px; }
}
