/* =========================================================
   RESOURCE HELP POPOVER
   Reusable contextual workflow help
   ========================================================= */

.resource-help {
  --resource-help-heading: #054c7b;
  --resource-help-primary: #007cbd;
  --resource-help-primary-hover: #00659b;
  --resource-help-text: #405363;
  --resource-help-tint: #e9f5fb;
  --resource-help-border: #c8dde9;
  --resource-help-white: #fff;

  position: relative;
  color: var(--resource-help-text);
  font-family: "Inter", sans-serif;
}


/* =========================================================
   TRIGGER
   ========================================================= */

.resource-help__trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;

  width: auto;
  margin: 0 0 14px;
  padding: 0;

  border: 0;
  background: transparent;

  color: var(--resource-help-heading);

  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  text-align: left;

  cursor: help;
}

.resource-help__trigger:hover {
  color: var(--resource-help-primary);
}

.resource-help__trigger:focus-visible {
  outline: 3px solid var(--resource-help-primary);
  outline-offset: 4px;
  border-radius: 4px;
}

.resource-help__trigger > .bi {
  flex-shrink: 0;
  font-size: 14px;
}

.resource-help__info {
  margin-left: 2px;
  font-size: 12px;
  opacity: .75;
}


/* =========================================================
   POPOVER
   ========================================================= */

.resource-help__popover {
  position: absolute;
  z-index: 20;

  bottom: calc(100% + 14px);
  left: 0;

  width: min(460px, calc(100vw - 48px));
  padding: 24px;

  border: 1px solid var(--resource-help-border);
  border-radius: 24px;

  background: var(--resource-help-white);
  color: var(--resource-help-text);

  box-shadow:
    0 12px 30px rgba(5, 76, 123, .12),
    0 2px 8px rgba(5, 76, 123, .08);

  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);

  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 160ms ease;
}


/* Popover pointer */

.resource-help__popover::after {
  content: "";

  position: absolute;
  bottom: -8px;
  left: 28px;

  width: 16px;
  height: 16px;

  border-right: 1px solid var(--resource-help-border);
  border-bottom: 1px solid var(--resource-help-border);

  background: var(--resource-help-white);

  transform: rotate(45deg);
}


/* Open state */

.resource-help__popover.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}


/* =========================================================
   POPOVER HEADER
   ========================================================= */

.resource-help__icon {
  display: grid;
  place-items: center;

  width: 48px;
  height: 48px;
  margin-bottom: 18px;

  border-radius: 14px;

  background: var(--resource-help-tint);
  color: var(--resource-help-heading);

  font-size: 22px;
}

.resource-help__title {
  margin: 0 0 20px;

  color: var(--resource-help-primary);

  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}


/* =========================================================
   NUMBERED STEPS
   ========================================================= */

.resource-help__steps {
  display: flex;
  flex-direction: column;
  gap: 14px;

  margin: 0 0 22px;
  padding: 0;

  list-style: none;
  counter-reset: resource-help-step;
}

.resource-help__steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;

  margin: 0;

  font-size: 13px;
  line-height: 1.55;

  counter-increment: resource-help-step;
}


/* Automatic step numbers */

.resource-help__steps li::before {
  content: counter(resource-help-step);

  display: grid;
  place-items: center;

  width: 28px;
  height: 28px;
  flex: 0 0 28px;

  border-radius: 50%;

  background: var(--resource-help-tint);
  color: var(--resource-help-heading);

  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}


/* Links inside instructions */

.resource-help__steps a {
  color: var(--resource-help-heading);
  font-weight: 700;

  text-decoration: underline;
  text-underline-offset: 2px;
}

.resource-help__steps a:hover {
  color: var(--resource-help-primary);
}

.resource-help__steps a:focus-visible {
  outline: 3px solid var(--resource-help-primary);
  outline-offset: 3px;
  border-radius: 2px;
}


/* =========================================================
   PRIMARY ACTION
   ========================================================= */

.resource-help__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  min-height: 44px;
  padding: 11px 22px;

  border: 1px solid var(--resource-help-primary);
  border-radius: 28px;

  background: var(--resource-help-primary);
  color: var(--resource-help-white);

  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;

  text-decoration: none;
}

.resource-help__action:hover {
  border-color: var(--resource-help-primary-hover);
  background: var(--resource-help-primary-hover);
  color: var(--resource-help-white);
  text-decoration: none;
}

.resource-help__action:focus-visible {
  outline: 3px solid var(--resource-help-heading);
  outline-offset: 4px;
}

.resource-help__action:active {
  border-color: var(--resource-help-heading);
  background: var(--resource-help-heading);
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 575.98px) {
  .resource-help__popover {
    width: min(340px, calc(100vw - 48px));
    padding: 20px;
  }

  .resource-help__title {
    font-size: 18px;
  }
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .resource-help__popover {
    transition: none;
  }
}