/* ============================================================
   Citu landing — Waitlist block
   Lives inside .brand (hero left). Self-contained: no dependency
   on the WhatsApp --wa-* variables. Mirrors the hero palette
   (royal blue accent, dark body, Geist via inherit).
   ============================================================ */

/* ============================================================
   Disclosure wrapper — by default only the heading button is visible.
   Click expands the panel (form). The same button collapses it (icon
   rotates from + to ×). After a successful submit the JS auto-closes
   the panel.
   ============================================================ */
.waitlist-wrap{
  width:100%;
  max-width:min(92vw, 460px);
  align-self:flex-end;
  display:flex;
  flex-direction:column;
  align-items:flex-end;       /* keeps toggle right-aligned on desktop */
  text-align:right;
  margin-top:clamp(.5rem, 2vw, 1rem);
}

/* The toggle is the only visible element when collapsed. Looks like a
   subtle eyebrow heading + a small icon that morphs (+ → ×). */
.waitlist-toggle{
  display:inline-flex;
  align-items:center;
  gap:.55rem;

  background:none;
  border:none;
  padding:.1rem .15rem;       /* slight hit-area without visible chrome */
  cursor:pointer;

  font-family:inherit;
  font-size:clamp(.9rem, 2.2vw, .92rem);
  font-weight:500;
  letter-spacing:.12em;
  line-height:1.2;
  text-transform:uppercase;
  color:var(--brand-lighter);

  transition:color .2s ease, opacity .2s ease;
}
.waitlist-toggle:hover{ color:var(--brand-soft) }
.waitlist-toggle:focus-visible{
  outline:none;
  color:var(--brand-soft);
  text-decoration:underline;
  text-underline-offset:4px;
  text-decoration-color:rgba(96,165,250,.45);
}
.waitlist-toggle-icon{
  width:10px;
  height:10px;
  flex-shrink:0;
  color:currentColor;
  transition:transform .25s ease;
}
.waitlist-wrap.is-open .waitlist-toggle-icon{
  transform:rotate(45deg);    /* + becomes × */
}

/* Collapsible panel. Uses the grid-template-rows 0fr→1fr trick to animate
   height auto smoothly. `inert` is toggled by JS to remove focus/AT
   reach when collapsed. */
.waitlist-panel{
  display:grid;
  grid-template-rows:0fr;
  transition:grid-template-rows .35s ease, margin-top .35s ease, opacity .25s ease;
  width:100%;
  margin-top:0;
  opacity:0;
}
.waitlist-panel > *{
  overflow:hidden;
  min-height:0;
}
.waitlist-wrap.is-open .waitlist-panel{
  grid-template-rows:1fr;
  margin-top:.9rem;
  opacity:1;
}

.waitlist{
  display:flex;
  flex-direction:column;
  text-align:right;
  width:100%;
}

/* Subheading under the label */
.waitlist-sub{
  font-size:clamp(.85rem, 1.6vw, 1rem);
  color:var(--text-muted);
  margin-top:.35rem;
  margin-bottom:1rem;
  line-height:1.5;
  font-weight:400;
}

/* Inputs stacked above the button — name on top, email below. */
.waitlist-fields{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:.5rem;
  width:100%;
  text-align:left;
  margin-bottom:.5rem;
}

/* Shared input style (name + email) */
.waitlist-input{
  flex:1 1 auto;
  min-width:0; /* let it shrink inside the flex row on narrow screens */

  background:rgba(255,255,255,.04);
  border:1px solid rgba(96,165,250,.18);
  border-radius:12px;
  padding:.85rem 1rem;

  color:var(--text-bright);
  font-family:inherit;
  font-size:.95rem;
  line-height:1.2;

  transition:
    border-color .2s ease,
    box-shadow   .2s ease,
    background   .2s ease;

  -webkit-appearance:none;
  appearance:none;
}
.waitlist-input::placeholder{
  color:var(--text-dim);
  opacity:1; /* Firefox normalize */
}
.waitlist-input:hover{
  border-color:rgba(96,165,250,.32);
}
.waitlist-input:focus{
  outline:none;
  border-color:var(--brand-primary);
  box-shadow:0 0 0 4px rgba(37,99,235,.18);
  background:rgba(255,255,255,.06);
}
.waitlist-input[aria-invalid="true"],
.waitlist-input.error{
  border-color:var(--semantic-danger-bd);
  box-shadow:0 0 0 4px rgba(248,113,113,.15);
}
.waitlist-input:disabled{
  opacity:.6;
  cursor:not-allowed;
}

/* Autofill — keep dark theme legible */
.waitlist-input:-webkit-autofill,
.waitlist-input:-webkit-autofill:hover,
.waitlist-input:-webkit-autofill:focus{
  -webkit-text-fill-color:var(--text-bright);
  -webkit-box-shadow:0 0 0 1000px rgba(20,28,44,.95) inset;
  caret-color:var(--text-bright);
  transition:background-color 9999s ease-in-out 0s;
}

/* Submit button */
.waitlist-btn{
  /* Full-width below the stacked inputs */
  width:100%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.5rem;

  background:linear-gradient(135deg,var(--brand-primary) 0%,var(--brand-primary-dark) 100%);
  color:var(--text-bright);
  font-family:inherit;
  font-weight:500;
  font-size:.95rem;
  line-height:1.2;

  border:none;
  border-radius:12px;
  padding:.85rem 1.4rem;

  cursor:pointer;
  box-shadow:0 8px 24px -8px rgba(37,99,235,.5);

  transition:
    transform   .15s ease,
    box-shadow  .2s  ease,
    opacity     .2s  ease,
    background  .2s  ease;

  -webkit-appearance:none;
  appearance:none;
  white-space:nowrap;
}
.waitlist-btn:hover:not(:disabled){
  transform:translateY(-1px);
  box-shadow:0 12px 32px -10px rgba(37,99,235,.62);
}
.waitlist-btn:active:not(:disabled){
  transform:translateY(0);
  box-shadow:0 6px 18px -6px rgba(37,99,235,.5);
}
.waitlist-btn:focus-visible{
  outline:none;
  box-shadow:
    0 0 0 4px rgba(37,99,235,.28),
    0 8px 24px -8px rgba(37,99,235,.5);
}
.waitlist-btn:disabled{
  opacity:.6;
  cursor:not-allowed;
  transform:none;
}

/* Loading spinner (rendered inside the button when .is-loading) */
.waitlist-btn .waitlist-spinner{
  width:.95em;
  height:.95em;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.35);
  border-top-color:var(--text-bright);
  animation:waitlistSpin .7s linear infinite;
  flex-shrink:0;
}
.waitlist-btn:not(.is-loading) .waitlist-spinner{ display:none }

@keyframes waitlistSpin{
  to{ transform:rotate(360deg) }
}

/* Confirmation check (when submission succeeded) */
.waitlist-btn.is-success{
  background:linear-gradient(135deg,#15803d 0%,#166534 100%);
  box-shadow:0 8px 24px -8px rgba(34,197,94,.45);
}

/* Status / feedback message */
.waitlist-msg{
  font-size:.82rem;
  margin-top:.65rem;
  line-height:1.4;
  min-height:1em;
  text-align:left;
  /* Hidden when no content (avoids reserving a visible blank line) */
}
.waitlist-msg:empty{
  display:none;
}
.waitlist-msg.success{
  color:var(--semantic-success);
}
.waitlist-msg.error{
  color:var(--semantic-danger-msg);
}

/* ============================================================
   Mobile — stack input/button vertically, recenter inside .brand
   .brand on mobile is align-items:center (default), so we match.
   ============================================================ */
@media (max-width:480px){
  .waitlist-fields{
    gap:.55rem;
  }
  .waitlist-btn{
    width:100%;
    padding:.9rem 1rem;
  }
  .waitlist-msg{
    text-align:center;
  }
  .waitlist{ text-align:center }
}

/* Below 920px the .brand block is centered (no right-align rule applies).
   Recenter the wrapper so the toggle matches the centered tagline. */
@media (max-width:919.98px){
  .waitlist-wrap{
    align-self:center;
    align-items:center;
    text-align:center;
  }
  .waitlist{ text-align:center }
  .waitlist-msg{ text-align:center }
}

@media (prefers-reduced-motion:reduce){
  .waitlist-input,
  .waitlist-btn{
    transition:none;
  }
  .waitlist-btn:hover:not(:disabled){
    transform:none;
  }
  .waitlist-btn .waitlist-spinner{
    animation:none;
    border-top-color:rgba(255,255,255,.7);
  }
}
