/* UHC Custom checkout: the customizer split into steps, a sticky stepper on
   top, a price dock at the bottom and a paper ticket at the end.
   Loaded after customizer.css on custom_tokens.html only (body.checkout). */

.checkout {
  --dock-h: 4.6rem;
  --paper: #f7f3ea;
  --paper-edge: #e7dfcf;
  --ink: #1d1b18;
  --ink-muted: #6b645a;
  --ink-rule: rgba(29, 27, 24, 0.14);
  --spectral: linear-gradient(90deg, #ffaa00, #ffd700 35%, #b48ae8 70%, #5cc8dc);
}
.checkout .wrap { padding-bottom: calc(var(--dock-h) + 3rem); }
.checkout .layout { display: block; }
/* The dock owns the bottom edge: toasts drop in from the top instead. */
.checkout .toast { top: 1rem; bottom: auto; transform: translate(-50%, -160%); }
.checkout .toast.show { transform: translate(-50%, 0); }

/* ── Hero: one line, promo on the right ── */
.hero--compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  flex-wrap: wrap;
  margin: 0.2rem 0 0.9rem;
}
.hero--compact .promo-banner { margin: 0; padding: 0.45rem 0.8rem; }

/* ── Stepper ── */
.stepper {
  position: sticky;
  top: 0.6rem;
  z-index: 40;
  margin-bottom: 1.1rem;
  padding: 0.45rem;
  border-radius: var(--radius-lg);
  background: var(--chrome-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  overflow: hidden;
}
.stepper__rail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--border);
}
.stepper__fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--spectral);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6);
  transition: width 0.5s var(--ease);
}
.stepper__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--steps, 6), minmax(0, 1fr));
  gap: 0.3rem;
}
.stepper__btn {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 0.55rem;
  align-items: center;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.stepper__btn:hover { background: var(--surface-soft); color: var(--text); }
.stepper__dot {
  grid-row: 1 / 3;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--glass-border);
  background: var(--surface-soft);
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.25s var(--ease);
}
.stepper__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: inherit;
  line-height: 1.2;
}
.stepper__sum {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stepper__item.is-done .stepper__dot {
  background: rgba(var(--ok-rgb), 0.14);
  border-color: rgba(var(--ok-rgb), 0.45);
  color: var(--ok);
}
.stepper__item.is-current .stepper__btn {
  background: rgba(var(--accent-rgb), 0.10);
  border-color: var(--edge);
  color: var(--title-color);
}
.stepper__item.is-current .stepper__dot {
  background: var(--accent);
  border-color: var(--accent-bright);
  color: var(--on-accent);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.18), 0 0 18px rgba(var(--accent-rgb), 0.45);
  transform: scale(1.06);
}

/* ── Steps ── */
.step[hidden] { display: none; }
.step-head { margin: 0 0 1rem; }
.step-kicker {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 0.2rem;
}
.step-head h2 {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--title-color);
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
}
.step-head p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 52rem;
}
[data-theme='light'] .step-head h2 { text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7); }
.step.is-in-fwd { animation: stepInFwd 0.38s var(--ease) both; }
.step.is-in-back { animation: stepInBack 0.38s var(--ease) both; }
@keyframes stepInFwd { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes stepInBack { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

.subhead--first { margin-top: 0; }

/* Server choice: big selectable cards with a radio mark. */
.checkout .host-cards { margin-bottom: 0.85rem; }
.checkout .host-card {
  position: relative;
  min-height: 7.5rem;
  padding: 1.1rem 1.2rem 1.1rem 3.2rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, var(--sheen-fill)) 0%, transparent 45%), var(--surface);
  border: 1px solid var(--glass-border);
}
.checkout .host-card::before {
  content: '';
  position: absolute;
  left: 1.15rem;
  top: 1.2rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.checkout .host-card.active::before {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface-solid), inset 0 0 0 10px var(--accent);
}
.checkout .host-card__title { font-size: 1.15rem; }
.checkout .host-card__meta { font-size: 0.8rem; }

/* Duration: a grid instead of a nine-row list. */
.checkout #durationSeg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .checkout #durationSeg { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .checkout #durationSeg { grid-template-columns: 1fr; } }

/* ── Final step: paper ticket + wallet ── */
.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
}
@media (max-width: 900px) { .checkout-grid { grid-template-columns: minmax(0, 1fr); } }
.checkout-side .panel { margin-bottom: 0.85rem; }
.checkout-side .same-day-notice { margin-top: 0; text-align: left; }

.receipt {
  position: relative;
  color: var(--ink);
  background:
    radial-gradient(ellipse at top, rgba(255, 255, 255, 0.7), transparent 60%),
    var(--paper);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 1.15rem 1.25rem 1.1rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 2px 0 var(--paper-edge) inset;
  transform: rotate(-0.6deg);
}
.receipt::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -9px;
  height: 10px;
  background:
    linear-gradient(135deg, var(--paper) 50%, transparent 50%) 0 0 / 14px 10px repeat-x,
    linear-gradient(225deg, var(--paper) 50%, transparent 50%) 0 0 / 14px 10px repeat-x;
}
.receipt__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 0.8rem;
  margin-bottom: 0.7rem;
  border-bottom: 2px dashed var(--ink-rule);
}
.receipt__head img { border-radius: 50%; }
.receipt__head strong {
  display: block;
  font-family: var(--font-pixel);
  font-size: 13px;
  letter-spacing: 0.04em;
  -webkit-font-smoothing: none;
}
.receipt__head span { font-size: 0.74rem; color: var(--ink-muted); }
.receipt .pill {
  color: #7a4e00;
  background: rgba(217, 169, 59, 0.22);
  border-color: rgba(154, 109, 28, 0.45);
}
.receipt .lines {
  max-height: none;
  overflow: visible;
  gap: 0;
  margin-bottom: 0.5rem;
}
.receipt .line {
  font-size: 0.86rem;
  color: var(--ink);
  padding: 0.32rem 0;
  border-bottom: 1px dotted var(--ink-rule);
}
.receipt .line .amt { font-weight: 600; }
.receipt .line .amt.neg { color: #2e7d32; }
.receipt .line--notes { color: var(--ink-muted); font-style: italic; }
.receipt .totals { border-top: 2px solid var(--ink); padding-top: 0.6rem; }
.receipt .total-row { color: var(--ink-muted); }
.receipt .total-row.final { color: var(--ink); font-size: 1.45rem; }
.receipt.is-printing .line { animation: linePrint 0.35s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.receipt.is-printing { animation: receiptIn 0.55s var(--ease) both; }
@keyframes receiptIn { from { opacity: 0; transform: translateY(-24px) rotate(-0.6deg); } to { opacity: 1; transform: rotate(-0.6deg); } }
@keyframes linePrint { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.receipt__barcode {
  height: 42px;
  margin: 1rem auto 0.35rem;
  width: 72%;
  background: repeating-linear-gradient(90deg,
    var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px,
    var(--ink) 8px 11px, transparent 11px 12px, var(--ink) 12px 13px, transparent 13px 17px,
    var(--ink) 17px 19px, transparent 19px 21px);
  opacity: 0.85;
}
.receipt__thanks {
  margin: 0;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
[data-theme='light'] .receipt { box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16); }

.wallet .balance-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wallet .bal--wide { grid-column: 1 / -1; background: rgba(var(--accent-rgb), 0.08); border-color: var(--edge); }
.wallet .bal--wide .v { font-size: 1.25rem; color: var(--accent-bright); }
@media (max-width: 560px) { .wallet .balance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wallet .afford { margin-top: 0; }
.wallet > .btn + .btn, .wallet > .btn + .wallet__rates, .wallet > .afford + .btn { margin-top: 0.55rem; }
.wallet__rates { margin: 0.75rem 0 0.6rem; font-size: 0.74rem; color: var(--muted); line-height: 1.5; }
.wallet__rates strong { color: var(--muted-strong); }

/* ── Price dock ── */
.dock {
  position: fixed;
  left: 50%;
  bottom: 0.8rem;
  transform: translateX(-50%);
  z-index: 60;
  width: min(calc(var(--max) - 2rem), calc(100% - 1.2rem));
  border-radius: var(--radius-xl);
  background: var(--chrome-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}
.dock::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 1.5rem;
  right: 1.5rem;
  height: 1px;
  background: var(--spectral);
  opacity: 0.7;
  pointer-events: none;
}
.dock__bar {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--dock-h);
  padding: 0.6rem 0.75rem;
}
.dock__back { min-height: 2.75rem; }
.dock__back:disabled { visibility: hidden; }
.dock__next { min-height: 2.75rem; padding: 0 1.3rem; font-size: 0.95rem; white-space: nowrap; }
#submitBtn.dock__next { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.5); }
#submitBtn.dock__next:not(:disabled) { animation: ctaPulse 2.2s ease-in-out infinite; }
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(var(--accent-rgb), 0); }
}
.dock__price {
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: 0.05rem;
  padding: 0.25rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dock__price:hover, .dock__price[aria-expanded='true'] { background: var(--surface-soft); border-color: var(--glass-border); }
.dock__label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.dock__count { letter-spacing: 0; text-transform: none; font-weight: 500; }
.dock__caret { display: inline-block; transition: transform 0.2s var(--ease); }
.dock__price[aria-expanded='true'] .dock__caret { transform: rotate(180deg); }
.dock__amount { display: flex; align-items: baseline; gap: 0.5rem; font-variant-numeric: tabular-nums; }
.dock__amount b {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--title-color);
  line-height: 1.1;
  transition: color 0.3s;
}
.dock__strike { font-size: 0.85rem; color: var(--muted); }
.dock__strike:empty { display: none; }
.dock__amount.is-up b { color: var(--accent-bright); animation: bump 0.45s var(--ease); }
.dock__amount.is-down b { color: var(--ok); animation: bump 0.45s var(--ease); }
@keyframes bump { 30% { transform: scale(1.12); } }
.dock__amount b { display: inline-block; }

/* Price changes float up out of the dock, one chip per change. */
.dock__ticker {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 0.6rem);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.3rem;
  pointer-events: none;
}
.tick {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: min(26rem, 80vw);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-up-solid);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  animation: tickUp 2.2s var(--ease) forwards;
}
.tick__amt { font-variant-numeric: tabular-nums; }
.tick__why { color: var(--muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.tick--up .tick__amt { color: var(--warn); }
.tick--down .tick__amt { color: var(--ok); }
.tick--zero .tick__amt { color: var(--info); }
@keyframes tickUp {
  0% { opacity: 0; transform: translateY(14px) scale(0.9); }
  12% { opacity: 1; transform: translateY(0) scale(1); }
  75% { opacity: 1; transform: translateY(-14px); }
  100% { opacity: 0; transform: translateY(-30px); }
}

.dock__receipt {
  max-height: min(52vh, 28rem);
  overflow: auto;
  padding: 0.9rem 1.1rem 0.4rem;
  border-bottom: 1px solid var(--glass-border);
  animation: drawerUp 0.3s var(--ease);
}
.dock__receipt[hidden] { display: none; }
@keyframes drawerUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.dock__receipt-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--title-color);
}
.dock__receipt-head span { color: var(--muted); font-size: 0.75rem; }
.dock__receipt .lines { max-height: none; margin-bottom: 0.5rem; }
.dock__receipt .line { font-size: 0.82rem; padding: 0.15rem 0; }
.dock__receipt .line.is-fresh { color: var(--text); animation: freshLine 1.6s ease; }
@keyframes freshLine { 0% { background: rgba(var(--accent-rgb), 0.25); } 100% { background: transparent; } }

/* ── Small screens ── */
@media (max-width: 860px) {
  .stepper__sum { display: none; }
  .stepper__btn { grid-template-columns: 1fr; justify-items: center; row-gap: 0.2rem; text-align: center; }
  .stepper__dot { grid-row: auto; }
  .stepper__title { font-size: 0.7rem; }
}
@media (max-width: 560px) {
  .checkout { --dock-h: 4rem; }
  .stepper__item:not(.is-current) .stepper__title { display: none; }
  .stepper__dot { width: 1.6rem; height: 1.6rem; font-size: 0.75rem; }
  .dock { bottom: 0.4rem; border-radius: var(--radius-lg); }
  .dock__bar { gap: 0.4rem; padding: 0.45rem 0.5rem; }
  .dock__back .dock__btn-text { display: none; }
  .dock__next-target { display: none; }
  .dock__next { padding: 0 0.85rem; font-size: 0.85rem; }
  .dock__price { padding: 0.2rem 0.4rem; }
  .dock__amount b { font-size: 1.3rem; }
  .dock__strike { display: none; }
  .checkout .host-card { min-height: 0; }
  .receipt { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .receipt { transform: none; }
  .tick { animation: none !important; }
}
