/* /login/ code step: six felt boxes, the paper plane, "Code sent" with Suri peeking. Presentation only (js/app/otp-ui.js).
   Motion is transform and opacity (the stitch uses clip-path); every animation sits behind no-preference. */

/* ---------- six boxes over the one real input */
.otpbox { position: relative; display: grid; gap: 10px; max-width: 340px; }
.otpbox__cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.otpbox__cell { display: grid; place-items: center; aspect-ratio: 5 / 6; border-radius: 14px; background: var(--field, #FFFDF8); color: var(--ink);
  font: 800 clamp(26px, 8vw, 34px)/1 var(--font-display); box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .16), 0 3px 0 rgba(90, 42, 0, .16); }
.otpbox__cell.is-full { background: var(--lemon, #FFE28A); box-shadow: inset 0 0 0 2px var(--sun-deep, #FF8F1F), 0 3px 0 rgba(90, 42, 0, .24); }
.otpbox:focus-within .otpbox__cell.is-active { box-shadow: inset 0 0 0 3px var(--blue, #2346C6), 0 3px 0 rgba(35, 70, 198, .3); }
/* the real input lies on top, invisible, and takes every tap, key, paste and autofill */
.otpbox .input--code, .pass .field .otpbox .input--code { position: absolute; inset: 0 0 12px; width: 100%; max-width: none; height: auto; padding: 0; border-radius: 14px;
  background: transparent; box-shadow: none; color: transparent; -webkit-text-fill-color: transparent; text-shadow: none; caret-color: transparent; font-size: 16px; letter-spacing: 0; cursor: text; }
.otpbox .input--code:focus, .otpbox .input--code:focus-visible { outline: none; box-shadow: none; }
.otpbox .input--code::selection { background: transparent; color: transparent; -webkit-text-fill-color: transparent; }
.otpbox:has(.input--code:focus-visible) .otpbox__cells { outline: 3px solid rgba(35, 70, 198, .35); outline-offset: 6px; border-radius: 16px; }
/* a wrong code: red boxes (the error text is the existing note) */
.otpbox.is-bad .otpbox__cell { background: var(--no-bg, #FFE0DC); color: var(--no-ink, #9A2B22); box-shadow: inset 0 0 0 2px var(--no, #C23B2E), 0 3px 0 rgba(154, 43, 34, .25); }
/* success: green boxes and the stitch */
.otpbox.is-ok .otpbox__cell { background: var(--ok-bg, #C9EFD9); color: var(--ok-ink, #1F6B3A); box-shadow: inset 0 0 0 2px var(--ok, #2E7D45), 0 3px 0 rgba(31, 107, 58, .25); }
.otpbox__stitch { display: block; height: 4px; border-radius: 2px; opacity: 0;
  background: repeating-linear-gradient(90deg, var(--ok, #2E7D45) 0 9px, transparent 9px 15px); clip-path: inset(0 100% 0 0); }
.otpbox.is-ok .otpbox__stitch { opacity: 1; clip-path: inset(0); }

@media (prefers-reduced-motion: no-preference) {
  html:not(.rm) .otpbox__cell.is-pop { animation: otp-pop 260ms var(--settle, cubic-bezier(.16, 1, .3, 1)) both; }
  html:not(.rm) .otpbox.is-paste .otpbox__cell.is-pop:nth-child(2) { animation-delay: 40ms; }
  html:not(.rm) .otpbox.is-paste .otpbox__cell.is-pop:nth-child(3) { animation-delay: 80ms; }
  html:not(.rm) .otpbox.is-paste .otpbox__cell.is-pop:nth-child(4) { animation-delay: 120ms; }
  html:not(.rm) .otpbox.is-paste .otpbox__cell.is-pop:nth-child(5) { animation-delay: 160ms; }
  html:not(.rm) .otpbox.is-paste .otpbox__cell.is-pop:nth-child(6) { animation-delay: 200ms; }
  html:not(.rm) .otpbox.is-shake .otpbox__cells { animation: pp-shake 460ms both; }
  html:not(.rm) .otpbox__stitch { transition: clip-path 460ms cubic-bezier(.45, 0, .2, 1), opacity 120ms linear; }
  html:not(.rm) .otpbox.is-ok .otpbox__cell { animation: otp-pop 300ms var(--settle, cubic-bezier(.16, 1, .3, 1)) both; }
  html:not(.rm) .otpbox.is-ok .otpbox__cell:nth-child(2) { animation-delay: 50ms; }
  html:not(.rm) .otpbox.is-ok .otpbox__cell:nth-child(3) { animation-delay: 100ms; }
  html:not(.rm) .otpbox.is-ok .otpbox__cell:nth-child(4) { animation-delay: 150ms; }
  html:not(.rm) .otpbox.is-ok .otpbox__cell:nth-child(5) { animation-delay: 200ms; }
  html:not(.rm) .otpbox.is-ok .otpbox__cell:nth-child(6) { animation-delay: 250ms; }
}
@keyframes otp-pop { 0% { transform: scale(.82); } 55% { transform: translateY(-4px) scale(1.08); } 100% { transform: none; } }

/* the pass colours every field white; the code field stays see-through over its boxes */
.pass .field .otpbox .input--code { background: transparent; }

/* ---------- "Code sent to name@..." with Suri peeking from the bottom edge */
.otp__step[data-form$="code"] > .hint:first-child, [data-nl="code"] > .hint { position: relative; overflow: hidden; min-height: 64px; padding: 12px 86px 12px 14px;
  border-radius: 16px; background: var(--lemon, #FFE28A); color: var(--ink-on-sun, #5A3A06); font-weight: 700; }
.otp__step[data-form$="code"] > .hint:first-child b, [data-nl="code"] > .hint b { color: var(--ink); overflow-wrap: anywhere; }
.otp__step[data-form$="code"] > .hint:first-child::after, [data-nl="code"] > .hint::after { content: ""; position: absolute; right: 8px; bottom: -22px; width: 68px; height: 74px;
  background: url(/assets/cast/mascots/suri-hero-a-480.webp) center top / contain no-repeat; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  html:not(.rm) .otp__step[data-form$="code"] > .hint:first-child::after, html:not(.rm) [data-nl="code"] > .hint::after { animation: otp-peek 700ms 120ms var(--settle, cubic-bezier(.16, 1, .3, 1)) both; }
}
@keyframes otp-peek { from { transform: translateY(46px) rotate(8deg); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }

/* ---------- the plane that leaves the email field */
.otp-plane { position: fixed; left: 0; top: 0; z-index: 90; width: 56px; height: 42px; pointer-events: none; will-change: transform, opacity; filter: drop-shadow(0 4px 3px rgba(90, 42, 0, .22)); }
.otp-plane svg { display: block; overflow: visible; }
.otp-plane__body { fill: #FFFDF8; stroke: var(--ink, #1E2A5A); stroke-width: 2.4; stroke-linejoin: round; }
.otp-plane__wing { fill: var(--sun, #FFCB3D); stroke: var(--ink, #1E2A5A); stroke-width: 2.4; stroke-linejoin: round; transform-box: fill-box; transform-origin: 100% 0; }
.otp-plane__tail { fill: #F8E6C6; stroke: var(--ink, #1E2A5A); stroke-width: 2.4; stroke-linejoin: round; }

/* ---------- resend: a quiet link with the countdown */
.acct__links [data-act$="resend"] { font-variant-numeric: tabular-nums; }

/* inside the narrow visitor pass: a smaller Suri so the address keeps its width */
.pass .otp__step[data-form$="code"] > .hint:first-child { padding-right: 62px; font-size: 14.5px; }
.pass .otp__step[data-form$="code"] > .hint:first-child::after { width: 50px; height: 56px; right: 6px; bottom: -16px; }
.pass .otp__step[data-form$="code"] > .hint:first-child b { font-size: 14px; }
