/* Sign-in page: Buddy prints the sign-in sheet. Brand: Ivory Blue, logo black, paper. */
body.bare:has(> .signin) { display: block; padding: 0; }
.signin {
  --w: min(440px, calc(100vw - 24px));
  --blue: #05AFE9; --black: #231F20; --paper: #F7F4EC; --sheet: #FFFFFF; --blush: #F59AC0;
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 20px 12px 28px; background: var(--paper); color: var(--black);
}
.signin-top { width: var(--w); max-width: 100%; display: flex; justify-content: flex-start; margin-bottom: clamp(8px, 4vh, 40px); }
.signin-top .lockup-big .logo { height: 54px; margin-left: 0; }
.signin-top .lockup-big .wordmark strong { font-size: 1.15rem; }
.signin-top .lockup-big .wordmark small { display: none; }

.stage { position: relative; width: var(--w); }

/* Speech bubble */
.bubble {
  position: absolute; right: -4px; top: calc(var(--w) * -0.105); z-index: 3;
  max-width: 62%; padding: 8px 14px; background: var(--sheet); border: 2.5px solid var(--black);
  border-radius: 18px 18px 18px 4px; font-weight: 700; font-size: .95rem; line-height: 1.25;
  transform-origin: 0 100%; transition: transform .25s cubic-bezier(.3,1.6,.5,1);
}
.bubble.pop { transform: scale(1.07); }
.bubble::after { content: ""; position: absolute; left: -2.5px; bottom: -11px; width: 14px; height: 11px; background: var(--black);
  clip-path: polygon(0 0, 100% 0, 0 100%); }

/* Buddy */
.buddy { position: relative; z-index: 2; display: block; width: 100%; }
.buddy-svg { display: block; width: 100%; height: auto; overflow: visible; }
.b-paper-in rect { fill: var(--sheet); stroke: var(--black); stroke-width: 3; }
.b-paper-in path { stroke: #CFE9F5; stroke-width: 3; stroke-linecap: round; fill: none; }
.b-paper-in { transform: rotate(-3deg); transform-origin: 194px 40px; }
.b-body { fill: var(--blue); stroke: var(--black); stroke-width: 5; }
.b-shine { fill: #FFFFFF; opacity: .4; }
.b-screen { fill: var(--black); }
.b-eye { fill: #EAF9FF; transform-box: fill-box; transform-origin: center; animation: b-blink 5.2s infinite; }
.b-eyes-shut path, .b-eyes-happy path, .b-brows path, .b-mouth { fill: none; stroke: #EAF9FF; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.b-mouth-grin { fill: #EAF9FF; }
.b-mouth-o { fill: #EAF9FF; stroke: none; }
.b-eyes-shut, .b-eyes-happy, .b-brows, .b-mouth-grin, .b-mouth-sad, .b-mouth-o { opacity: 0; }
.b-look { transition: transform .18s ease-out; }
.b-cheek { fill: var(--blush); opacity: 0; transition: opacity .3s; }
.b-led { fill: #7DE3A6; stroke: var(--black); stroke-width: 3; animation: b-breathe 2.6s ease-in-out infinite; }
.b-pad, .b-slot { fill: var(--black); }
.b-hand rect { fill: var(--blue); stroke: var(--black); stroke-width: 4.5; }
.b-hand path { stroke: var(--black); stroke-width: 3.5; stroke-linecap: round; }
.b-hand { transition: transform .42s cubic-bezier(.34,1.45,.55,1); }
.b-hand-l { transform: translate(12px, 104px) rotate(-172deg); }
.b-hand-r { transform: translate(376px, 104px) rotate(172deg); }

/* States, set on .stage */
.is-shy .b-hand-l { transform: translate(160px, 88px) rotate(-10deg); }
.is-shy .b-hand-r { transform: translate(228px, 88px) rotate(10deg); }
.is-shy .b-cheek, .is-happy .b-cheek { opacity: .9; }
.is-shy .b-eyes, .is-happy .b-eyes { opacity: 0; }
.is-shy .b-eyes-shut { opacity: 1; }
.is-shy .b-mouth-smile, .is-happy .b-mouth-smile, .is-sad .b-mouth-smile, .is-oh .b-mouth-smile { opacity: 0; }
.is-shy .b-mouth-o, .is-oh .b-mouth-o { opacity: 1; }
.is-peek .b-hand-r { transform: translate(250px, 120px) rotate(40deg); }
.is-happy .b-eyes-happy, .is-happy .b-mouth-grin { opacity: 1; }
.is-happy .b-led { fill: #3FD27A; animation: none; }
.is-sad .b-brows, .is-sad .b-mouth-sad { opacity: 1; }
.is-sad .b-led, .is-caps .b-led { animation: none; }
.is-sad .b-led { fill: #F05A5A; }
.is-caps .b-led { fill: #FFC93C; }
.is-sad .buddy { animation: b-shake .55s ease-in-out; }

/* The sign-in sheet comes out of Buddy's slot */
.feed { position: relative; z-index: 1; margin-top: calc(var(--w) * -0.111); overflow: hidden; padding: 0 10px 18px; }
.sheet {
  width: 74%; margin: 0 auto; background: var(--sheet); border: 1.5px solid #E2DDD1; border-top: 0;
  border-radius: 0 0 6px 6px; box-shadow: 0 10px 22px -12px rgba(35, 31, 32, .35);
  padding: calc(var(--w) * 0.075) 22px 22px;
}
.sheet h1 { font-size: 1.55rem; font-weight: 800; font-stretch: 92%; margin: 0 0 2px; letter-spacing: -.01em; }
.sheet .lede { margin: 0 0 16px; color: #5A5F66; font-size: .92rem; }
.sheet .form label { margin-bottom: 12px; }
.sheet .pw { position: relative; }
.sheet .pw input { padding-right: 64px; }
.sheet .reveal { position: absolute; right: 6px; bottom: 6px; border: 0; background: none; font: inherit; font-size: .82rem; font-weight: 700;
  color: #0A6E9C; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.sheet .reveal:focus-visible { outline: 3px solid var(--blue); outline-offset: 1px; }
.sheet .caps { display: block; font-size: .82rem; color: #7A5A00; font-weight: 600; margin-top: 4px; }
.sheet .caps[hidden] { display: none; }
.sheet .btn.primary { margin-top: 6px; }
.sheet .help { margin: 14px 0 0; font-size: .82rem; color: #6A707A; }
.sheet .flash { margin-bottom: 14px; }

.signin .authfoot { margin-top: 18px; }

/* One opening moment: Buddy wakes, then prints the sheet in small feed steps */
.anim .buddy { animation: b-wake .6s cubic-bezier(.3,1.5,.6,1) both; }
.anim .b-led { animation: b-led-on .9s steps(1) both, b-breathe 2.6s 1s ease-in-out infinite; }
.anim .sheet { animation: b-feed 1.25s .45s cubic-bezier(.2,.7,.3,1) both; }
.anim .bubble { animation: b-say .35s 1.5s cubic-bezier(.3,1.6,.5,1) both; }
.anim.is-sad .buddy { animation: b-wake .6s cubic-bezier(.3,1.5,.6,1) both, b-shake .55s 1.6s ease-in-out; }
.leaving .sheet { animation: b-take .55s cubic-bezier(.6,0,.8,.4) both; }

@keyframes b-wake { from { transform: translateY(14px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes b-feed {
  0% { transform: translateY(-101%); } 18% { transform: translateY(-82%); } 26% { transform: translateY(-80%); }
  44% { transform: translateY(-55%); } 52% { transform: translateY(-53%); } 70% { transform: translateY(-24%); }
  78% { transform: translateY(-22%); } 100% { transform: translateY(0); }
}
@keyframes b-take { to { transform: translateY(-101%); } }
@keyframes b-say { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes b-blink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes b-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes b-led-on { 0% { fill: #3A3536; } 30% { fill: #7DE3A6; } 45% { fill: #3A3536; } 60% { fill: #7DE3A6; } }
@keyframes b-shake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-3deg); } 40% { transform: rotate(3deg); } 60% { transform: rotate(-2deg); } 80% { transform: rotate(1.5deg); } }

@media (max-width: 420px) {
  .sheet { width: 82%; padding-left: 16px; padding-right: 16px; }
  .bubble { font-size: .85rem; max-width: 70%; }
}
@media (prefers-reduced-motion: reduce) {
  .signin *, .signin *::before, .signin *::after { animation: none !important; transition: none !important; }
}
