/* Sign-in / sign-up modals, notices, toasts and the cookie banner for pages on
   the site shell (the new landing, plan-landing-redesign S2). Copied from
   public/beta.css (Modal, Toast, Cookie, consent, spinner rules), re-pointed at
   the shell theme tokens (web/src/shared/tokens.css) so they follow dark/light.
   beta.css itself is untouched: the editor still loads it. */
:root {
  --au-surface: #1a1712;
  --au-field: #0c0b0a;
  --au-backdrop: rgba(0, 0, 0, .78);
  --au-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --au-error-fg: #ffd9d4;
  --au-error-bg: rgba(220, 64, 52, .13);
  --au-error-edge: rgba(220, 64, 52, .42);
  --au-ok: #5fbf80;
  --au-cb-edge: rgba(255, 255, 255, .35);
  --au-cb-on: #fff;
  --au-cb-mark: #111;
}
:root[data-theme="light"] {
  --au-surface: #fffaf0;
  --au-field: #f5eedf;
  --au-backdrop: rgba(28, 23, 18, .55);
  --au-shadow: 0 12px 40px rgba(43, 33, 20, .22);
  --au-error-fg: #8c1d12;
  --au-error-bg: rgba(220, 64, 52, .08);
  --au-error-edge: rgba(180, 50, 40, .4);
  --au-ok: #2f7d4a;
  --au-cb-edge: rgba(43, 33, 20, .45);
  --au-cb-on: #1c1712;
  --au-cb-mark: #f8f1e2;
}

/* Buttons used inside the modals */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; text-decoration: none;
  min-height: 52px; padding: 0 28px; background: var(--btn-bg); color: var(--btn-fg); font: 600 16px/1.2 var(--sans);
  border: none; border-radius: 999px; cursor: pointer; transition: transform .15s ease, background-color .2s ease; }
.btn-primary:hover { background: var(--btn-bg-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary:active:not(:disabled), .btn-google:active { transform: translateY(0) scale(.98); }
.btn-full { width: 100%; }
.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 20px;
  background: #fff; color: #1f1f1f; font: 600 15px/1.2 var(--sans); border: 1px solid var(--hair-strong); border-radius: 999px;
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.btn-google:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(0, 0, 0, .12); }
.btn-ghost { background: transparent; border: none; color: var(--dim); font: 400 13px/1.2 var(--sans); cursor: pointer; padding: 12px; min-height: 44px; }
.btn-ghost:hover { color: var(--strong); }
.modal-divider { font-size: 12px; color: var(--dim); text-align: center; margin: 14px 0; }

/* Modal */
.modal-backdrop { display: flex; position: fixed; inset: 0; background: var(--au-backdrop); z-index: 200; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility .22s ease; }
.modal-backdrop.open { opacity: 1; visibility: visible; pointer-events: auto; }
.modal-card { width: 100%; max-width: 420px; max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--au-surface);
  border: 1px solid var(--hair-strong); border-radius: 18px; padding: 28px 24px; box-shadow: var(--au-shadow); color: var(--body);
  font: 400 15px/1.5 var(--sans); opacity: 0; transform: translateY(14px) scale(.97);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1), opacity .26s ease; }
.modal-backdrop.open .modal-card { opacity: 1; transform: translateY(0) scale(1); }
.modal-card h2 { font-family: var(--font-display); font-weight: var(--font-display-weight); font-size: 24px; line-height: 1.15;
  color: var(--strong); margin: 0 0 8px; letter-spacing: -.02em; }
.modal-card p { margin: 0; }
.modal-sub { font-size: 14px; color: var(--dim); margin-bottom: 20px !important; line-height: 1.5; }
.modal-sub a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }
.modal-card form { margin: 0; }
.modal-card input[type="email"], .modal-card input[type="password"] { width: 100%; padding: 14px 16px; font: 400 16px/1.3 var(--sans);
  border-radius: 12px; border: 1px solid var(--hair-strong); background: var(--au-field); color: var(--strong); margin: 0 0 14px;
  outline: none; transition: border-color .18s ease, box-shadow .18s ease; }
.modal-card input[type="email"]:focus, .modal-card input[type="password"]:focus { border-color: var(--gold-edge); box-shadow: 0 0 0 3px var(--gold-wash); }
.modal-card input::placeholder { color: var(--dim); }
.auth-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 0 14px; padding: 4px; border: 1px solid var(--hair);
  border-radius: 999px; background: var(--wash); }
.auth-toggle button { min-height: 44px; border: 0; border-radius: 999px; background: transparent; color: var(--dim);
  font: 600 13px/1.2 var(--sans); cursor: pointer; transition: color .15s ease, background .18s ease; }
.auth-toggle button.active { background: var(--btn-bg); color: var(--btn-fg); }
.auth-link { display: block; width: fit-content; margin: -4px 0 10px auto; border: 0; background: transparent; color: var(--accent);
  font: 600 13px/1.4 var(--sans); cursor: pointer; }
.auth-link:hover { color: var(--strong); }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.modal-fineprint { font-size: 12px; color: var(--dim); line-height: 1.45; text-align: center; margin: 14px 0 0 !important; }
.modal-fineprint a { color: var(--accent); text-decoration: none; }
.modal-fineprint a:hover { text-decoration: underline; }
.turnstile-slot { margin: 4px 0 12px; min-height: 65px; display: flex; justify-content: center; }
.modal-msg { font-size: 13px; color: var(--dim); }
.modal-msg:empty { display: none; }
.modal-msg.error, .modal-msg.ok { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; padding: 11px 13px; border-radius: 11px;
  font-size: 13.5px; line-height: 1.45; animation: msgShake .34s ease both; }
.modal-msg.error { color: var(--au-error-fg); background: var(--au-error-bg); border: 1px solid var(--au-error-edge); }
.modal-msg.error::before { content: "!"; flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: rgba(220, 64, 52, .9);
  color: #fff; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.modal-msg a, .modal-msg a:link, .modal-msg a:visited { color: var(--accent); text-decoration: none; font-weight: 500; }
.modal-msg a:hover { color: var(--strong); text-decoration: underline; }
.modal-msg.ok { color: var(--accent); background: var(--gold-wash); border: 1px solid var(--gold-edge); animation: none; }
.pw-req { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); margin: 0 0 12px !important; transition: color .15s ease; }
.pw-req-dot { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pw-req-dot::after { content: ""; width: 4px; height: 7px; margin-top: -1px; border: solid transparent; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pw-req.met { color: var(--au-ok); }
.pw-req.met .pw-req-dot { background: var(--au-ok); border-color: var(--au-ok); }
.pw-req.met .pw-req-dot::after { border-color: var(--au-surface); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* Consent checkboxes (ui-fx.js wraps them; ui-fx.css draws them white-on-dark) */
.auth-consent { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--dim); line-height: 1.5; cursor: pointer;
  user-select: none; margin: 12px 0 0; text-align: left; }
.auth-consent a { color: var(--accent); text-decoration: none; }
.auth-consent a:hover { text-decoration: underline; }
.auth-consent.shake { animation: consentShake .4s ease; border-radius: 8px; padding: 8px; box-shadow: 0 0 0 2px var(--focus); }
.modal-card .cb { margin-top: 3px; }
.modal-card .cb-box { border-color: var(--au-cb-edge); }
.modal-card .cb-box[data-state="checked"] { background: var(--au-cb-on); border-color: var(--au-cb-on); }
.modal-card .cb-mark { color: var(--au-cb-mark); }

/* Button spinner */
.btn-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn-loading > * { opacity: 0; }
.btn-loading::after { content: ""; position: absolute; width: 18px; height: 18px; top: 50%; left: 50%; margin: -9px 0 0 -9px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--btn-fg) 25%, transparent); border-top-color: var(--btn-fg); animation: btnSpin .6s linear infinite; }
.btn-google.btn-loading::after { border-color: rgba(31, 31, 31, .25); border-top-color: #1f1f1f; }
.btn-ghost.btn-loading::after { border-color: var(--hair-strong); border-top-color: var(--strong); }

/* Toasts */
.toast-host { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-radius: 12px; font: 500 14px/1.4 var(--sans); color: var(--strong);
  background: var(--au-surface); border: 1px solid var(--hair-strong); box-shadow: var(--au-shadow); animation: toastIn .26s cubic-bezier(.2, .8, .2, 1) both; }
.toast.leaving { animation: toastOut .22s ease both; }
.toast.error { border-color: var(--au-error-edge); }
.toast.success { border-color: var(--gold-edge); }
.toast::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.toast.error::before { background: #e0584c; }
.toast.success::before { background: var(--gold); }

/* Cookie banner */
.cookie-banner { position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom, 0px)); z-index: 9000; display: none; gap: 12px;
  align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; background: var(--au-surface);
  border: 1px solid var(--hair-strong); border-radius: 12px; box-shadow: var(--au-shadow); font: 400 13px/1.5 var(--sans); color: var(--dim); }
.cookie-banner.visible { display: flex; }
.cookie-banner a { color: var(--accent); text-decoration: none; }
.cookie-banner a:hover { text-decoration: underline; }
.cookie-banner button { flex: 0 0 auto; padding: 10px 16px; min-height: 44px; background: var(--btn-bg); color: var(--btn-fg); border: 0; border-radius: 999px;
  font: 600 13px/1.2 var(--sans); cursor: pointer; }

@keyframes btnSpin { to { transform: rotate(360deg); } }
@keyframes msgShake { 0% { transform: translateX(0); } 18% { transform: translateX(-5px); } 38% { transform: translateX(4px); }
  58% { transform: translateX(-3px); } 78% { transform: translateX(2px); } 100% { transform: translateX(0); } }
@keyframes consentShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

@media (max-width: 480px) {
  .modal-backdrop { padding: 12px; }
  .modal-card { padding: 22px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal-card, .toast, .modal-msg, .auth-consent { transition: none !important; animation: none !important; }
}
