/* The payment loading with the shield that closes: the checkout panel of a store on a black page. The panel is dark
   glass with a 1px edge; a conic light (.pay__beam) runs around that edge only while the payment is being processed.
   The shield, the checks and the button are one sequence driven by script.js. */
:root {
  --page: #000000;           /* the page */
  --panel: #0f1113;          /* the body of the panel */
  --panel-top: #16191c;      /* the top of the panel, where the light falls */
  --edge: rgba(255, 255, 255, 0.08); /* the edge at rest */
  --ink: #eef1f2;            /* the words */
  --muted: #7d868c;          /* the small words */
  --dim: #3a4146;            /* the words of a check still to come */
  --accent: #5fe3b2;         /* the colour of the shield, the light and the bar */
  --accent-deep: #1f8f6c;    /* the deep end of the liquid */
  --button: #f3f5f4;         /* the Pay button */
  --button-ink: #06110d;     /* the words on the buttons */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: hidden;
}

/* the panel */
.pay {
  --mx: 50%;
  --my: 0%;
  --warm: 0;
  position: relative;
  width: min(372px, 90vw);
  padding: clamp(14px, 4.2vh, 24px) clamp(16px, 5vw, 22px) clamp(14px, 3.8vh, 20px);
  border-radius: 22px;
  background:
    radial-gradient(120% 70% at var(--mx) var(--my), rgba(255, 255, 255, 0.045), transparent 60%),
    linear-gradient(180deg, var(--panel-top), var(--panel) 46%);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 18px 40px -18px rgba(0, 0, 0, 0.9),
    0 40px 90px -40px color-mix(in srgb, var(--accent) calc(var(--warm) * 30%), transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  isolation: isolate;
  opacity: 0;
}

/* a fine grain over the glass */
.pay::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

/* the light that runs around the edge: a conic gradient shown only on a 1px ring */
.pay__beam {
  --a: 0deg;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--a), transparent 0deg, transparent 250deg, color-mix(in srgb, var(--accent) 60%, transparent) 310deg, #ffffff 344deg, var(--accent) 352deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

/* the soft glow the beam leaves on the inside of the panel */
.pay__glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 26px -8px color-mix(in srgb, var(--accent) calc(var(--warm) * 55%), transparent);
  z-index: 0;
}

.pay > *:not(.pay__beam):not(.pay__glow) {
  position: relative;
  z-index: 1;
}

/* the shield */
.pay__shield {
  width: clamp(42px, 11.5vh, 64px);
  aspect-ratio: 64 / 72;
}

.pay__shield svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.shield__base {
  fill: rgba(255, 255, 255, 0.025);
  stroke: rgba(255, 255, 255, 0.09);
  stroke-width: 1.4;
}

.shield__fill {
  fill: url(#shield-fill);
}

.shield__surface {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-opacity: 0.85;
}

.shield__glint {
  fill: url(#shield-glint);
}

.shield__line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-dasharray: 1;
}

.shield__lock {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shield__body {
  fill: var(--panel);
}

.shield__check {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
}

/* the amount and the status */
.pay__amount {
  margin: clamp(8px, 2.4vh, 14px) 0 0;
  font-size: clamp(26px, min(8.6vw, 8vh), 34px);
  line-height: 1;
  font-weight: 640;
  font-variation-settings: 'wdth' 94;
  letter-spacing: -0.03em;
}

.pay__status {
  position: relative;
  height: 18px;
  width: 100%;
  margin-top: 6px;
  overflow: hidden;
}

.pay__status-line {
  position: absolute;
  inset: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--muted);
  font-variation-settings: 'wdth' 100;
}

.pay__status-line--ok {
  color: var(--accent);
}

/* the three checks */
.pay__steps {
  list-style: none;
  margin: clamp(10px, 3vh, 18px) 0 0;
  padding: clamp(8px, 1.8vh, 10px) 12px;
  width: 100%;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.022);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  text-align: left;
  display: grid;
  gap: clamp(4px, 1.1vh, 7px);
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 20px;
}

.step__icon {
  flex: none;
  width: 16px;
  height: 16px;
  overflow: visible;
}

.step__spin {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 0.28 0.72;
  transform-origin: 8px 8px;
  opacity: 0;
}

.step__tick {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
}

.step__words {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 20px;
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
}

.step__base,
.step__type,
.step__done {
  position: absolute;
  left: 0;
  top: 0;
}

.step__base {
  color: var(--dim);
}

.step__type {
  color: var(--ink);
}

.step__done {
  color: var(--ink);
  opacity: 0;
}

/* the card and the security line */
.pay__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: clamp(10px, 2.8vh, 16px);
  font-size: 12px;
  color: var(--muted);
}

.pay__card,
.pay__sec {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.pay__card svg {
  width: 20px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
}

.pay__sec svg {
  width: 10px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}

/* the foot keeps the height of the button, so the panel does not move when the button becomes the bar */
.pay__foot {
  width: 100%;
  height: 44px;
  margin-top: clamp(8px, 2vh, 12px);
  display: flex;
  align-items: center;
}

/* the button that becomes the bar and the bar that becomes the button */
.pay__btn {
  position: relative;
  display: block;
  width: 100%;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 6px 16px -8px rgba(255, 255, 255, 0.25);
}

.pay__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.pay__btn[aria-busy='true'] {
  cursor: progress;
}

.pay__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent) 70%, color-mix(in srgb, var(--accent) 60%, #ffffff));
  transform-origin: left center;
  transform: scaleX(0);
  overflow: hidden;
}

/* the liquid's sheen, sliding through the fill */
.pay__shine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 60%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: shine 1.4s linear infinite;
}

@keyframes shine {
  to {
    transform: translateX(270%);
  }
}

.pay__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pay__label--done {
  opacity: 0;
}

.pay__label svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.pay__label svg path {
  stroke-dasharray: 1;
}

@media (hover: hover) {
  .pay__btn:not([aria-busy='true']):hover .pay__label {
    font-variation-settings: 'wdth' 114;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pay__shine {
    animation: none;
    opacity: 0;
  }
}
