/* The waitlist form, as a popup on whatever page the reader is on (assets/waitlist.js draws it).
   Self-contained: it uses only the colour and font names the home page and the portal pages both define,
   with fallbacks, so it looks the same on either. On a phone it rises from the bottom as a sheet. */

.dwl { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px;
  font-family: var(--sans, 'Poppins', system-ui, sans-serif); }
.dwl[hidden] { display: none; }
.dwl-back { position: absolute; inset: 0; background: rgba(3, 2, 8, 0.8); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); animation: dwl-fade 0.22s ease both; }
.dwl-card { position: relative; width: min(460px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
  border-radius: 26px; padding: 30px 28px 24px; color: var(--text, #f6f0e6);
  background: radial-gradient(100% 70% at 50% 0%, rgba(242, 193, 78, 0.13), transparent 70%), linear-gradient(180deg, #151230, #0c0a1a);
  border: 1px solid var(--line, rgba(242, 193, 78, 0.26)); box-shadow: 0 34px 90px rgba(0, 0, 0, 0.65), 0 0 70px rgba(242, 193, 78, 0.09);
  animation: dwl-rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.dwl-card:focus { outline: none; }
.dwl-x { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  color: var(--muted, #d4cab8); background: rgba(255, 255, 255, 0.05); border: 1px solid transparent; transition: color 0.2s, border-color 0.2s; }
.dwl-x:hover { color: var(--gold-2, #ffdf9a); border-color: var(--line, rgba(242, 193, 78, 0.26)); }
.dwl-x svg { width: 16px; height: 16px; }
.dwl-mark { height: 30px; width: auto; margin-bottom: 14px; }
.dwl-kick { display: block; font-size: 12.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gold, #f2c14e); margin-bottom: 8px; }
.dwl h2 { font: 400 clamp(26px, 6.4vw, 31px)/1.12 var(--serif, 'Marcellus', Georgia, serif); letter-spacing: -0.005em; margin: 0; padding-right: 36px;
  -webkit-text-stroke: 0.028em currentColor; paint-order: stroke fill; }
.dwl-lede { margin: 10px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--muted, #d4cab8); font-weight: 400; }
.dwl-form { display: flex; flex-direction: column; gap: 15px; margin-top: 22px; }
.dwl-field { display: flex; flex-direction: column; gap: 6px; }
.dwl-field label { font-size: 13.5px; font-weight: 600; color: var(--text, #f6f0e6); }
.dwl-field input { width: 100%; font: 500 16px var(--sans, 'Poppins', system-ui, sans-serif); color: var(--text, #f6f0e6); background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(242, 193, 78, 0.28); border-radius: 14px; padding: 13px 15px; min-height: 50px; -webkit-appearance: none; appearance: none; transition: border-color 0.2s, background 0.2s; }
.dwl-field input::placeholder { color: #8e8576; font-weight: 400; }
.dwl-field input:focus { outline: none; border-color: var(--gold, #f2c14e); background: rgba(255, 255, 255, 0.09); box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.14); }
.dwl-field.bad input { border-color: #ff6b4a; }
.dwl-field .dwl-msg { font-size: 12.5px; color: #ffab91; min-height: 0; }
.dwl-phone { display: flex; align-items: stretch; }
.dwl-phone .dwl-cc { display: grid; place-items: center; padding: 0 14px; font-weight: 600; font-size: 15px; color: var(--gold-2, #ffdf9a); background: rgba(242, 193, 78, 0.08);
  border: 1px solid rgba(242, 193, 78, 0.28); border-right: 0; border-radius: 14px 0 0 14px; transition: opacity 0.2s; }
.dwl-phone .dwl-cc.off { opacity: 0.35; }
.dwl-phone input { border-radius: 0 14px 14px 0; }
.dwl-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.dwl-err { margin: 0; padding: 11px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; color: #ffd2c4; background: rgba(255, 90, 61, 0.12); border: 1px solid rgba(255, 90, 61, 0.35); }
.dwl-err[hidden] { display: none; }
.dwl-go { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; margin-top: 2px; cursor: pointer;
  font: 600 15.5px/1.1 var(--sans, 'Poppins', system-ui, sans-serif); color: var(--ink-on-gold, #1a1205); background: var(--gold, #f2c14e); border: 0; border-radius: 999px; padding: 15px 26px;
  transition: transform 0.2s, background 0.2s; }
.dwl-go:hover { background: var(--gold-2, #ffdf9a); transform: translateY(-1px); }
.dwl-go:disabled { opacity: 0.65; cursor: default; transform: none; }
.dwl-go .dwl-spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: dwl-spin 0.8s linear infinite; }
.dwl-fine { margin: 0; text-align: center; font-size: 12.5px; line-height: 1.5; color: var(--dim, #a89d8a); font-weight: 400; }
.dwl-fine a { color: var(--gold-2, #ffdf9a); }

.dwl-done { text-align: center; padding: 6px 0 2px; }
.dwl-done[hidden] { display: none; }
.dwl-tick { width: 64px; height: 64px; border-radius: 50%; margin: 6px auto 18px; display: grid; place-items: center; color: #44e6a2;
  background: rgba(68, 230, 162, 0.12); border: 1px solid rgba(68, 230, 162, 0.4); box-shadow: 0 0 34px rgba(68, 230, 162, 0.18); animation: dwl-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.dwl-tick svg { width: 30px; height: 30px; }
.dwl-done h2 { padding-right: 0; }
.dwl-done .dwl-lede { max-width: 34ch; margin-left: auto; margin-right: auto; }
.dwl-done .dwl-go { margin-top: 22px; background: transparent; color: var(--gold-2, #ffdf9a); border: 1px solid var(--line, rgba(242, 193, 78, 0.26)); }
.dwl-done .dwl-go:hover { background: rgba(242, 193, 78, 0.07); border-color: var(--gold, #f2c14e); }

html.dwl-lock, html.dwl-lock body { overflow: hidden; }

@keyframes dwl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dwl-rise { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes dwl-sheet { from { transform: translateY(100%); } to { transform: none; } }
@keyframes dwl-spin { to { transform: rotate(360deg); } }
@keyframes dwl-pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }

/* on a phone it is a sheet from the bottom edge, with room for the home bar and the keyboard */
@media (max-width: 560px) {
  .dwl { align-items: flex-end; padding: 0; }
  .dwl-card { width: 100%; max-height: 94vh; max-height: 94dvh; border-radius: 26px 26px 0 0; padding: 26px 20px calc(22px + env(safe-area-inset-bottom, 0px)); animation: dwl-sheet 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  .dwl-card::before { content: ''; position: absolute; top: 9px; left: 50%; width: 42px; height: 4px; margin-left: -21px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); }
  .dwl-x { top: 16px; right: 14px; }
  .dwl-mark { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .dwl-back, .dwl-card, .dwl-tick { animation: none; }
  .dwl-go { transition: none; }
}
