/* =========================================================
   Intelligent Maqra'ah, waitlist pop-up
   Load AFTER styles.css:  <link rel="stylesheet" href="waitlist.css" />
   Colours follow the brand: Royal Teal, Purple, White, Black.
   ========================================================= */

.wl {
  /* Light mode */
  --wl-surface: #FFFFFF;
  --wl-text: #1C1824;
  --wl-muted: #5E566B;
  --wl-border: #D8D0E2;
  --wl-field: #FBF9FD;
  --wl-teal: #0F6B70;
  --wl-purple: #4B1F73;
  --wl-purple-hover: #3A175A;
  --wl-heading: #4B1F73;
  --wl-accent: #4B1F73;
  --wl-qaf: #4B1F73;
  --wl-error: #B3261E;
  --wl-ring: rgba(15, 107, 112, 0.3);

  border: 0;
  padding: 0;
  margin: auto;
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  border-radius: 20px;
  background: var(--wl-surface);
  color: var(--wl-text);
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  box-shadow: 0 24px 64px rgba(20, 10, 35, 0.35);
  overflow: hidden auto;
}

/* Dark mode (matches the site's data-theme switch) */
[data-theme="dark"] .wl {
  --wl-surface: #2D2635;
  --wl-text: #F3EEF8;
  --wl-muted: #BDB3C9;
  --wl-border: #4A4157;
  --wl-field: #251F2C;
  --wl-teal: #5CC2BD;
  --wl-purple: #5B2A8C;
  --wl-purple-hover: #6C36A3;
  --wl-heading: #DCC8F2;
  --wl-accent: #DCC8F2;
  --wl-qaf: #FFFFFF;
  --wl-error: #FF8A80;
  --wl-ring: rgba(92, 194, 189, 0.35);
}

.wl::backdrop {
  background: rgba(20, 12, 30, 0.6);
  backdrop-filter: blur(3px);
}

.wl[open] { animation: wl-in 0.22s ease-out; }

@keyframes wl-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wl[open] { animation: none; }
}

/* Stop the page behind from scrolling while the pop-up is open */
html:has(.wl[open]) { overflow: hidden; }

/* Teal to purple strip along the top */
.wl-bar {
  height: 6px;
  background: linear-gradient(90deg, var(--wl-teal), var(--wl-purple));
}

.wl-inner {
  position: relative;
  padding: 32px 32px 28px;
}

/* Qaf Emblem: large ق bleeding off the top-right corner, very low opacity */
.wl-qaf {
  position: absolute;
  top: -48px;
  right: -20px;
  font-family: 'Amiri', serif;
  font-size: 220px;
  line-height: 1;
  color: var(--wl-qaf);
  opacity: 0.06;
  pointer-events: none;
  user-select: none;
}

.wl-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--wl-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.wl-close:hover { background: color-mix(in srgb, var(--wl-purple) 12%, transparent); color: var(--wl-text); }
.wl-close:focus-visible { outline: 3px solid var(--wl-teal); outline-offset: 2px; }
.wl-close svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }

.wl-title {
  position: relative;
  margin: 0 40px 8px 0;
  font-size: 1.6rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--wl-heading);
}

.wl-intro {
  position: relative;
  margin: 0 0 24px;
  color: var(--wl-muted);
  line-height: 1.55;
}

/* Fields: name + phone side by side, email full width */
.wl-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.wl-field { display: flex; flex-direction: column; gap: 6px; }
.wl-field--full { grid-column: 1 / -1; }
.wl-field label { font-weight: 600; font-size: 0.92rem; }
.wl-req { color: var(--wl-accent); }
.wl-opt { font-weight: 400; color: var(--wl-muted); }

.wl-field input {
  font: inherit;
  font-size: 1rem;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--wl-border);
  border-radius: 12px;
  background: var(--wl-field);
  color: var(--wl-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wl-field input::placeholder { color: var(--wl-muted); opacity: 0.7; }
.wl-field input:focus { outline: none; border-color: var(--wl-teal); box-shadow: 0 0 0 4px var(--wl-ring); }
.wl-field input[aria-invalid="true"] { border-color: var(--wl-error); }

.wl-msg {
  min-height: 1.25em;
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--wl-error);
  text-align: center;
}

.wl-submit {
  display: block;
  min-width: 220px;
  margin: 10px auto 0;
  padding: 14px 28px;
  border: 0;
  border-radius: 999px;
  background: var(--wl-purple);
  color: #FFFFFF;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.wl-submit:hover { background: var(--wl-purple-hover); }
.wl-submit:active { transform: translateY(1px); }
.wl-submit:focus-visible { outline: 3px solid var(--wl-teal); outline-offset: 3px; }
.wl-submit[disabled] { opacity: 0.7; cursor: progress; }

.wl-note {
  margin: 18px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--wl-muted);
  text-align: center;
}
.wl-note a { color: var(--wl-teal); }

/* Hidden spam trap: real people never see or fill this */
.wl-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Thank-you screen */
.wl-success { position: relative; text-align: center; padding: 12px 0 4px; }
.wl-success .wl-title { margin: 0 0 8px; }
.wl-success .wl-intro { margin-bottom: 0; }
.wl-success .wl-submit { margin-top: 24px; }
.wl-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--wl-teal) 14%, transparent);
  color: var(--wl-teal);
  display: grid;
  place-items: center;
}
.wl-success-icon svg { width: 32px; height: 32px; stroke: currentColor; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Phones */
@media (max-width: 560px) {
  .wl-inner { padding: 28px 20px 22px; }
  .wl-title { font-size: 1.4rem; }
  .wl-grid { grid-template-columns: 1fr; }
  .wl-submit { width: 100%; min-width: 0; }
  .wl-qaf { font-size: 180px; }
}
