/* ==========================================================================
   Calculator: the savings hero, the savings bar that follows the scroll,
   and "What your savings can buy". Builds on the variables and cards in
   style.css.
   ========================================================================== */

/* ---------- Savings hero: the 5-year saving, first thing on the page ---------- */
.hero {
  position: relative; overflow: hidden;
  margin-bottom: 24px; padding: 28px 28px 26px;
  border-radius: 22px; color: #fff;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(135deg, #12a072 0%, var(--green-700) 50%, var(--green-900) 100%);
  box-shadow: 0 26px 50px -28px rgba(6, 78, 59, .8);
  animation: cardIn .6s var(--ease) both;
}
.hero::after {
  content: ""; position: absolute; right: -110px; bottom: -150px;
  width: 340px; height: 340px; border-radius: 50%;
  border: 46px solid rgba(255, 255, 255, .07); pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }

.hero-kicker { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .82); }
.hero-amount {
  margin-top: 8px; font-size: clamp(2.6rem, 9vw, 4.2rem); font-weight: 800;
  letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums;
}
.hero-sub { margin-top: 12px; font-size: 15px; color: rgba(255, 255, 255, .9); }
.hero-sub strong { font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }

.hero-buy {
  display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 14px 16px;
  border-radius: 16px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2);
}
.hero-buy-icon {
  flex: none; width: 54px; height: 54px; border-radius: 15px;
  display: grid; place-items: center; background: #fff; color: var(--green-700);
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, .45);
}
.hero-buy-text { min-width: 0; font-size: 16px; line-height: 1.4; font-weight: 600; }
.hero-buy-text strong { font-weight: 800; }

.hero-goal { margin-top: 20px; }
.hero-goal-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, .9);
}
.hero-goal-head strong { font-weight: 800; color: #fff; }
.hero-goal-left { flex: none; font-weight: 800; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hero-goal-track { margin-top: 10px; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.hero-goal-fill {
  height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #fef3c7, #fbbf24);
  transition: width .8s var(--ease);
}

/* ---------- Savings bar: the saving stays on screen while the page scrolls ---------- */
.save-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); box-shadow: 0 12px 28px -20px rgba(6, 78, 59, .55);
  visibility: hidden; transform: translateY(-105%);
  transition: transform .35s var(--ease), visibility .35s;
}
.save-bar.is-visible { visibility: visible; transform: none; }
.save-bar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px;
}
.save-bar-amount {
  display: flex; align-items: baseline; gap: 10px; white-space: nowrap;
  font-size: 14px; font-weight: 700; color: var(--ink-2);
}
.save-bar-amount strong {
  font-size: 20px; font-weight: 800; letter-spacing: -.01em; color: var(--green-900);
  font-variant-numeric: tabular-nums;
}
.save-bar-goal {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 700; color: var(--muted);
}

/* ---------- What your savings can buy ---------- */
.buy-grid {
  display: grid; gap: 12px; margin: 0; padding: 0; list-style: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 760px) { .buy-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.buy-tile {
  position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 16px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  animation: rise .55s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 70ms);
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.buy-tile:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: 0 14px 26px -20px rgba(6, 78, 59, .5); }
.buy-tile.is-reached { background: linear-gradient(180deg, #ffffff 0%, var(--mint) 100%); border-color: var(--mint-2); }
.buy-tile.is-next { border-color: #fcd34d; }
.buy-tile.is-best { border-color: var(--green); box-shadow: 0 0 0 1px var(--green), 0 18px 30px -22px rgba(15, 138, 95, .9); }

.buy-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-height: 26px; }
.buy-icon {
  flex: none; width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center; background: var(--mint); color: var(--green-700);
}
.buy-icon svg, .hero-buy-icon svg {
  width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.buy-badge {
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .02em;
  background: var(--green); color: #fff; white-space: nowrap;
}
.buy-badge[hidden] { display: none; }
.buy-tile.is-next .buy-badge { background: #fef3c7; color: #92400e; }

.buy-name { font-size: 15px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }
.buy-price { font-size: 13px; font-weight: 600; color: var(--muted); }
.buy-count { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin-top: 4px; }
.buy-big {
  font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; line-height: 1;
  color: var(--green-900); font-variant-numeric: tabular-nums;
}
.buy-big-label { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.buy-bar { height: 8px; border-radius: 999px; background: var(--mint-2); overflow: hidden; }
.buy-fill { height: 100%; width: 0; border-radius: inherit; background: var(--green); transition: width .8s var(--ease); }
.buy-tile.is-next .buy-fill { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.buy-foot { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Phone ---------- */
@media (max-width: 560px) {
  .hero { padding: 24px 20px 22px; border-radius: 20px; }
  .hero-buy-text { font-size: 15px; }
  .save-bar-goal { display: none; }
  .buy-tile { padding: 14px; }
  .buy-big { font-size: 1.5rem; }
}
