/* =====================================================================
   audioMCP.ai — WAITLIST MODAL
   DESIGN PROTOTYPE ONLY — REQUIRES PRODUCTION REIMPLEMENTATION
   ---------------------------------------------------------------------
   This stylesheet is layered on top of the compiled GitHub Pages build.
   It reuses the site's existing design tokens (CSS custom properties
   defined on :root by the production bundle) so the modal reads as
   native audioMCP.ai UI. Nothing here should ship as-is; the development
   team must recreate this in the real React/Vite + Tailwind source.
   See WAITLIST-DESIGN-HANDOFF.md.
   ===================================================================== */

/* ---- Local prototype-only tokens ----------------------------------- */
/* The production palette exposes --color-success but no danger/error
   token. These locals fill that gap and centralise modal sizing. */
:root {
  --wl-error: #ff6b6b;
  --wl-error-strong: #ff8f8f;
  --wl-error-wash: rgba(255, 107, 107, 0.12);
  --wl-error-border: rgba(255, 107, 107, 0.55);
  --wl-modal-max: 620px;          /* within the 580–640px target */
  --wl-modal-radius: 16px;        /* == --radius-lg */
  --wl-field-radius: 8px;         /* == --radius-md */
  --wl-gutter: 16px;              /* mobile outer spacing */
}

/* ---- Overlay / backdrop -------------------------------------------- */
.wl-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;            /* above the app + any sticky header */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(16px, 6vh, 64px) var(--wl-gutter);
  background: rgba(4, 7, 12, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overflow-y: auto;               /* allow scroll when viewport is short */
  overscroll-behavior: contain;
}
.wl-overlay[hidden] { display: none; }

/* ---- Modal surface ------------------------------------------------- */
.wl-modal {
  position: relative;
  width: 100%;
  max-width: var(--wl-modal-max);
  max-height: 90vh;
  margin: auto;                   /* vertical centering when it fits */
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(34, 201, 224, 0.10), transparent 60%),
    var(--color-surface, #111722);
  color: var(--color-on-surface, #e8eef4);
  border: 1px solid var(--color-border-strong, #3d4759);
  border-radius: var(--wl-modal-radius);
  /* restrained cyan glow, matching the site's --glow-live treatment */
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(34, 201, 224, 0.16),
    0 0 32px rgba(34, 201, 224, 0.14);
  font-family: var(--font-body, "Inter", system-ui, sans-serif);
  overflow: hidden;               /* keep the rounded corners clipping the scroll area */
}

/* scrollable inner region */
.wl-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(24px, 4vw, 36px);
  padding-top: clamp(24px, 4vw, 40px);
}

/* thin cyan accent bar along the top edge */
.wl-modal::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary, #22c9e0), transparent);
  opacity: 0.7;
  pointer-events: none;
}

/* ---- Close button -------------------------------------------------- */
.wl-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 44px;                    /* >= 44px target */
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-md, 8px);
  background: transparent;
  color: var(--color-on-surface-muted, #a4b4c6);
  cursor: pointer;
  transition: background var(--duration-fast, .15s), color var(--duration-fast, .15s);
}
.wl-close:hover {
  background: var(--color-surface-2, #19212e);
  color: var(--color-on-surface, #e8eef4);
}
.wl-close svg { width: 20px; height: 20px; }

/* ---- Header block -------------------------------------------------- */
.wl-title {
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-size: clamp(1.375rem, 3vw, 1.75rem);   /* deliberately not oversized */
  font-weight: 700;
  line-height: 1.15;
  margin: 0 40px 8px 0;           /* keep clear of the close button */
  color: var(--color-on-surface, #e8eef4);
}
.wl-desc {
  font-size: var(--text-body, 1rem);
  line-height: 1.5;
  color: var(--color-on-surface-muted, #a4b4c6);
  margin: 0 0 24px;
  max-width: 46ch;
}

/* ---- Form ---------------------------------------------------------- */
.wl-form { display: flex; flex-direction: column; gap: 18px; }

.wl-field { display: flex; flex-direction: column; gap: 6px; }

.wl-label {
  font-size: var(--text-label, 0.8125rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--color-on-surface, #e8eef4);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.wl-req {
  color: var(--color-primary, #22c9e0);
  font-weight: 700;
}
.wl-optional {
  font-weight: 500;
  color: var(--color-on-surface-subtle, #7c8b9f);
  font-size: 0.75rem;
}

.wl-input,
.wl-textarea {
  width: 100%;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: var(--text-body, 1rem);
  color: var(--color-on-surface, #e8eef4);
  background: var(--color-canvas, #0a0e14);
  border: 1px solid var(--color-border, #26303f);
  border-radius: var(--wl-field-radius);
  padding: 12px 14px;
  min-height: 46px;
  transition: border-color var(--duration-fast, .15s), box-shadow var(--duration-fast, .15s);
  -webkit-appearance: none;
  appearance: none;
}
.wl-textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}
.wl-input::placeholder,
.wl-textarea::placeholder { color: var(--color-on-surface-subtle, #7c8b9f); }

.wl-input:hover,
.wl-textarea:hover { border-color: var(--color-border-strong, #3d4759); }

.wl-input:focus,
.wl-textarea:focus {
  outline: none;
  border-color: var(--color-primary, #22c9e0);
  box-shadow: 0 0 0 3px var(--color-primary-wash, rgba(34, 201, 224, 0.12));
}

.wl-help {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--color-on-surface-subtle, #7c8b9f);
}

/* ---- Field error state (color + icon + border: never color alone) -- */
.wl-input.is-invalid,
.wl-textarea.is-invalid {
  border-color: var(--wl-error-border);
  box-shadow: 0 0 0 3px var(--wl-error-wash);
}
.wl-error-msg {
  display: none;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--wl-error-strong);
  font-weight: 500;
}
.wl-error-msg svg { flex: none; width: 15px; height: 15px; margin-top: 1px; }
.wl-field.is-invalid .wl-error-msg { display: flex; }
/* redundant non-color cue: bold label + prefix already provided by icon */

/* ---- Checkbox ------------------------------------------------------ */
.wl-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--color-border, #26303f);
  border-radius: var(--wl-field-radius);
  background: var(--color-surface-2, #19212e);
  cursor: pointer;
  transition: border-color var(--duration-fast, .15s), background var(--duration-fast, .15s);
}
.wl-check:hover { border-color: var(--color-border-strong, #3d4759); }
.wl-check:has(input:checked) {
  border-color: rgba(34, 201, 224, 0.6);
  background: var(--color-primary-wash, rgba(34, 201, 224, 0.10));
}
.wl-check input[type="checkbox"] {
  flex: none;
  width: 24px;                    /* >= 24px target */
  height: 24px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--color-primary, #22c9e0);
}
.wl-check-text {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--color-on-surface-muted, #a4b4c6);
}
.wl-check:has(input:checked) .wl-check-text { color: var(--color-on-surface, #e8eef4); }

/* ---- Honeypot (spam demo) — visually & programmatically hidden ----- */
.wl-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
  opacity: 0;
}

/* ---- Form-level error banner --------------------------------------- */
.wl-form-error {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--wl-error-border);
  border-left-width: 3px;
  border-radius: var(--wl-field-radius);
  background: var(--wl-error-wash);
  color: var(--wl-error-strong);
  font-size: 0.875rem;
  line-height: 1.45;
}
.wl-form-error[data-show="true"] { display: flex; }
.wl-form-error svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

/* ---- Submit area --------------------------------------------------- */
.wl-submit-area { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }

.wl-submit {
  position: relative;
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: var(--text-body, 1rem);
  font-weight: 600;
  color: var(--color-on-primary, #0a0e14);
  background: var(--color-primary, #22c9e0);
  border: 1px solid transparent;
  border-radius: var(--wl-field-radius);
  cursor: pointer;
  transition: background var(--duration-fast, .15s), transform var(--duration-fast, .15s);
}
.wl-submit:hover:not(:disabled) {
  background: var(--color-primary-press, #15a8be);
  transform: translateY(-1px);
}
.wl-submit:disabled { cursor: not-allowed; opacity: 0.75; }

/* The button is width:100%, so showing the spinner alongside the visible
   "Joining…" label causes no layout shift and keeps the label available to
   assistive tech (paired with aria-busy on the button). */
.wl-spinner {
  display: none;
  width: 18px; height: 18px;
  flex: none;
  border: 2px solid rgba(10, 14, 20, 0.35);
  border-top-color: var(--color-on-primary, #0a0e14);
  border-radius: 50%;
  animation: wl-spin 0.7s linear infinite;
}
.wl-submit[aria-busy="true"] .wl-spinner { display: inline-block; }
@keyframes wl-spin { to { transform: rotate(360deg); } }

.wl-privacy {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--color-on-surface-subtle, #7c8b9f);
  text-align: center;
  margin: 0;
}
.wl-privacy a {
  color: var(--color-primary, #22c9e0);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.wl-privacy a:hover { color: var(--color-primary-press, #15a8be); }
/* Styled placeholder used only when no real Privacy Policy route exists.
   The dev team must replace this with the production URL. */
.wl-privacy .wl-privacy-tbd {
  color: var(--color-on-surface-muted, #a4b4c6);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: help;
}

/* ---- Success view -------------------------------------------------- */
.wl-success { text-align: center; padding: 8px 4px; }
.wl-success-icon {
  width: 56px; height: 56px;
  margin: 4px auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-success, #4ade8b);
  background: rgba(74, 222, 139, 0.12);
  border: 1px solid rgba(74, 222, 139, 0.4);
}
.wl-success-icon svg { width: 28px; height: 28px; }
.wl-success-title {
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-size: clamp(1.375rem, 3vw, 1.625rem);
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--color-on-surface, #e8eef4);
}
.wl-success-msg {
  font-size: var(--text-body, 1rem);
  line-height: 1.55;
  color: var(--color-on-surface-muted, #a4b4c6);
  margin: 0 auto 8px;
  max-width: 42ch;
}
.wl-success-beta {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-primary, #22c9e0);
  margin: 12px auto 0;
  max-width: 42ch;
}
.wl-success-close {
  margin-top: 28px;
  min-height: 48px;
  padding: 0 28px;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: var(--text-body, 1rem);
  font-weight: 600;
  color: var(--color-on-primary, #0a0e14);
  background: var(--color-primary, #22c9e0);
  border: none;
  border-radius: var(--wl-field-radius);
  cursor: pointer;
  transition: background var(--duration-fast, .15s), transform var(--duration-fast, .15s);
}
.wl-success-close:hover { background: var(--color-primary-press, #15a8be); transform: translateY(-1px); }

/* ---- Screen-reader-only live region -------------------------------- */
.wl-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Focus indicators (match site: 2px cyan, offset 2px) ----------- */
.wl-overlay :focus-visible {
  outline: 2px solid var(--color-focus-ring, #22c9e0);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Entrance animation (subtle; disabled for reduced motion) ------ */
@media (prefers-reduced-motion: no-preference) {
  .wl-overlay { animation: wl-fade 0.2s var(--ease-standard, ease); }
  .wl-modal { animation: wl-rise 0.25s var(--ease-emphasis, cubic-bezier(.2,.8,.2,1)); }
}
@keyframes wl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wl-rise {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .wl-spinner { animation-duration: 1.2s; }   /* keep a slow, non-flashing cue */
}

/* ---- Body scroll lock helper --------------------------------------- */
html.wl-lock, body.wl-lock { overflow: hidden !important; }

/* ---- Responsive: near-full-width sheet on small screens ------------ */
@media (max-width: 520px) {
  .wl-overlay { padding: var(--wl-gutter); align-items: stretch; }
  .wl-modal { max-height: calc(100dvh - 2 * var(--wl-gutter)); margin: 0; }
  .wl-scroll { padding: 20px 18px 24px; }
  .wl-title { font-size: 1.3125rem; margin-right: 44px; }
}
/* very short viewports: let the modal use the full height and scroll */
@media (max-height: 640px) {
  .wl-overlay { align-items: stretch; padding-block: var(--wl-gutter); }
  .wl-modal { max-height: calc(100dvh - 2 * var(--wl-gutter)); }
}
