/* Self-hosted captcha widget (assets/js/captcha.js). Uses the tokens from vanguard.css. */

.captcha {
  --captcha-error: #d9473c;
  display: grid;
  gap: 10px;
  margin: 0 0 15px;
}

.captcha[hidden] {
  display: none !important;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* The frame keeps its own dark surface, so the code stays readable on light and dark backgrounds. */
.captcha-image {
  display: block;
  flex: 0 1 220px;
  width: 220px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 220 / 72;
  background: #11161b;
  border: 1px solid var(--line, #343c43);
  border-radius: 2px;
  box-shadow: inset 0 2px 6px #0008;
}

.captcha-refresh {
  flex-shrink: 0;
  min-height: 44px;
  padding: 8px 14px;
  color: var(--white, #f2f4f6);
  background: linear-gradient(#303940, #1c2329);
  border: 1px solid #63717c;
  border-bottom-color: #293239;
  border-radius: 2px;
  box-shadow: inset 0 1px 0 #a7b4bd35, 0 3px 8px #0004;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  transition: filter 0.15s;
}

.captcha-refresh:active {
  transform: translateY(1px);
}

.captcha-refresh:disabled {
  cursor: wait;
  opacity: 0.6;
}

.captcha-field {
  display: block;
  margin: 0;
  font-size: 11px;
  color: inherit;
  opacity: 0.85;
}

.captcha-label {
  display: block;
}

.captcha-field input {
  margin-top: 7px;
  min-height: 44px;
  padding: 9px 12px;
  color: var(--white, #f2f4f6);
  background: #0b1014;
  border: 1px solid #4c5964;
  border-radius: 2px;
  box-shadow: inset 0 2px 5px #0006;
  font-family: Barlow, "Arial Narrow", sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
}

.captcha-field input::placeholder {
  color: #63717b;
}

.captcha-field input:focus-visible {
  outline: 1px solid var(--amber, #ff8a1f);
  border-color: var(--amber, #ff8a1f);
}

.captcha-status {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
}

.captcha-status:empty {
  display: none;
}

.captcha-status.is-error {
  color: var(--captcha-error);
  font-weight: 600;
}

.captcha-refresh:focus-visible {
  outline: 2px solid var(--amber, #ff8a1f);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .captcha-refresh:hover:not(:disabled) {
    filter: brightness(1.15);
  }
}

@media (max-width: 480px) {
  .captcha-row {
    flex-direction: column;
    align-items: stretch;
  }

  .captcha-image {
    flex-basis: auto;
    width: 100%;
  }

  .captcha-refresh {
    width: 100%;
  }
}
