/*
 * Cloudflare Turnstile Widget Styling
 * Make it less intrusive while maintaining functionality
 */

/* Hidden turnstile for landing page forms */
.hidden-turnstile {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}

/* When challenge is needed, show it as a modal overlay */
.hidden-turnstile:has(iframe[style*="height"]:not([style*="height: 0"])) {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  width: auto;
  height: auto;
  padding: 1.5rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--color-neutral-primary, white);
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
}

/* Backdrop when turnstile challenge appears */
.hidden-turnstile:has(iframe[style*="height"]:not([style*="height: 0"]))::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

/* Turnstile in auth forms - centered and subtle */
.auth-turnstile {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: center;
  min-height: 0;
}

.auth-turnstile .cloudflare-turnstile {
  transform: scale(0.9);
  transform-origin: center;
}

/* When the widget is in interaction-only mode and hasn't been triggered */
.auth-turnstile .cloudflare-turnstile:has(.cf-turnstile:empty),
.auth-turnstile .cloudflare-turnstile .cf-turnstile:empty {
  min-height: 0;
}

/* Dark theme adjustments for turnstile */
@media (prefers-color-scheme: dark) {
  .hidden-turnstile:has(iframe[style*="height"]:not([style*="height: 0"])) {
    background: var(--color-neutral-primary-medium, #1f2937);
  }
}
