*,
*::before,
*::after {
  margin: 0;
  box-sizing: border-box;
}

:root {
  --text-primary-clr: #2e3f57;
  --text-secondary-clr: rgb(88, 108, 147);
  --step-transition: 220ms;
}

html {
  height: 100%;
}

body {
  display: grid;
  place-items: center;

  height: 100%;
  margin: 0;

  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  color: var(--text-primary-clr);
}

.integration {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;

  max-width: 320px;

  text-align: center;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 8px;

  opacity: 0;
  transform: translateY(-6px);
  transition: opacity var(--step-transition) ease,
    transform var(--step-transition) ease;
}

.step.is-hidden {
  display: none;
}

.step.is-active {
  opacity: 1;
  transform: translateY(0);
}

.step.is-active .step__title {
  animation: pulse-text 1s ease-in-out infinite;
}

.step__label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary-clr);
}

.step__title {
  font-size: 1rem;
  font-weight: 600;
}

@keyframes pulse-text {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--step-transition) ease,
    transform var(--step-transition) ease;
}

.result.is-hidden {
  display: none;
}

.result:not(.is-hidden) {
  opacity: 1;
  transform: translateY(0);
}

.result__text-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result__title {
  font-size: 1rem;
  font-weight: 600;
}

.result--success .result__title {
  color: #368636;
}

.result--error .result__title {
  color: #ee294c;
}

.result__message {
  font-size: 0.875rem;
  color: var(--text-secondary-clr);
}

.result__icon-wrapper {
  position: relative;
  display: inline-block;
}

.result__icon svg {
  display: block;
  width: 5rem;
  height: 5rem;
}

.result__timer-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  width: 6.5rem;
  height: 6.5rem;
  pointer-events: none;
  overflow: visible;
}

.result__timer-ring circle {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 326.56; /* Circle length (2πr) */
  stroke-dashoffset: 0;
  opacity: 0.3;
}

.result--success .result__timer-ring circle {
  stroke: #57a857;
}

.result--error .result__timer-ring circle {
  stroke: #ee294c;
}

.result__progress {
  opacity: 1;
  animation: circular-countdown var(--auto-close-duration) linear forwards;
}

@keyframes circular-countdown {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: 326.56;
  }
}

.result__icon svg {
  animation: scale-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scale-in {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.result--success .result__icon svg path {
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  animation: draw-check 0.5s ease-out 0.3s forwards;
}

@keyframes draw-check {
  to {
    stroke-dashoffset: 0;
  }
}
