/* =========================================================
   AIRES — Sign up / sign in dialog (load after main.css)
   Built from designs/sign up (WEB + MOBILE)
   ========================================================= */
.auth-page { overflow: hidden; }
.auth [hidden] { display: none !important; }
.m-only { display: none; }

/* Background: the home hero, first slide, filling the viewport */
.hero--auth { height: calc(100svh - var(--header-h)); min-height: 520px; }

/* ---------- Overlay ---------- */
.auth {
  --red: #d92d20; --ok: #079455; --ok-bg: #ecfdf3; --ok-ink: #067647;
  position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); z-index: 100;
  display: flex; padding: 24px; overflow-y: auto; overscroll-behavior: contain;
}
.auth__scrim {
  position: fixed; inset: 0; background: rgba(10,13,20,.5);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  view-transition-name: auth-scrim;
  animation: auth-fade .5s ease both, auth-blur .9s .2s ease both;
}
@keyframes auth-fade { from { opacity: 0; } }
@keyframes auth-blur { from { -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); } }

/* ---------- Card ---------- */
.auth__card {
  position: relative; z-index: 1; margin: auto; width: 496px; max-width: 100%;
  padding: 40px 48px 48px; background: #fff; color: var(--ink);
  box-shadow: 0 50px 100px -30px rgba(0,0,0,.55), 0 18px 36px -18px rgba(0,0,0,.3);
  view-transition-name: auth-card;
  animation: auth-card-in .8s var(--ease-out) .05s both;
}
.auth__card.is-morphing { overflow: hidden; }
.auth__card.is-nudge { animation: auth-nudge .45s var(--ease-out); }
@keyframes auth-card-in { from { opacity: 0; transform: translateY(32px) scale(.97); } }
@keyframes auth-nudge { 35% { transform: scale(1.018); } }
/* Arriving through a cross-page view transition: the transition itself moves the card */
.vt .auth__card, .vt .auth__scrim { animation: none; }

.auth__top { position: relative; height: 40px; margin-bottom: 13px; display: flex; align-items: center; justify-content: center; }
.auth__mark { position: relative; width: 56px; height: 56px; flex: none; display: grid; place-items: center; color: var(--blue); }
.auth__mark svg { width: 37px; height: 29px; overflow: visible; fill: currentColor; }
.auth__mark::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid currentColor; opacity: 0; pointer-events: none; }
.auth__mark.is-flying svg { animation: mark-fly .9s var(--ease-in-out); }
.auth__mark.is-done::after { animation: mark-ring 1.2s var(--ease-out) .4s; }
@keyframes mark-fly {
  0% { transform: none; opacity: 1; }
  38% { transform: translate(30px, -24px) scale(.5); opacity: 0; }
  39% { transform: translate(-30px, 24px) scale(.5); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
@keyframes mark-ring { from { opacity: .55; transform: scale(.55); } to { opacity: 0; transform: scale(1.75); } }
@keyframes mark-in { from { opacity: 0; transform: translate(-26px, 22px) scale(.5); } }

.auth__close {
  position: absolute; right: 0; top: 0; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; color: var(--ink); transition: background .25s, transform .5s var(--ease-out);
}
.auth__close .icon { width: 24px; height: 24px; }
.auth__close:hover { background: var(--soft); transform: rotate(90deg); }
.auth__close:active { transform: rotate(90deg) scale(.88); }

/* ---------- Steps ---------- */
.auth__viewport { position: relative; }
.auth__step.is-leaving { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; animation: step-out .32s cubic-bezier(.4,0,1,1) forwards; }
.auth__step.is-entering > * { animation: step-in .6s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 45ms + 110ms); }
@keyframes step-out { to { opacity: 0; transform: translateX(calc(var(--dir, 1) * -28px)); } }
@keyframes step-in { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 28px)); } }

/* First paint: the card rises, then its contents follow one by one */
.auth.is-intro .auth__top { animation: auth-rise .7s var(--ease-out) .2s backwards; }
.auth.is-intro .auth__mark svg { animation: mark-in 1s var(--ease-out) .3s backwards; }
.auth.is-intro .auth__step:not([hidden]) > * { animation: auth-rise .7s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 55ms + 280ms); }
@keyframes auth-rise { from { opacity: 0; transform: translateY(14px); } }

/* Sign up ⇄ sign in text swap */
.auth__title, .auth__sub, .auth__alt, .auth__legal { transition: opacity .18s, transform .18s; }
.is-swapping { opacity: 0; transform: translateY(-6px); }
.is-swapped { animation: auth-rise .5s var(--ease-out); }

/* ---------- Type ---------- */
.auth__title { font: 600 24px/32px var(--font-ui); letter-spacing: -.01em; text-align: center; color: var(--ink); outline: none; }
.auth__sub { margin-top: 8px; font-size: 14px; line-height: 20px; color: var(--body); text-align: center; }
.auth__sent { display: flex; align-items: center; justify-content: center; gap: 4px; }
.auth__sent b { font-weight: 400; color: var(--ink); }
.auth__edit {
  width: 28px; height: 28px; margin: -4px 0 -4px 4px; display: grid; place-items: center; border-radius: 50%; color: var(--ink);
  transition: background .2s, transform .45s var(--ease-spring);
}
.auth__edit .icon { width: 18px; height: 18px; }
.auth__edit:hover { background: var(--soft); transform: rotate(-14deg); }
.auth__alt { margin-top: 48px; font-size: 14px; line-height: 20px; color: var(--body); text-align: center; }
.auth__legal { margin-top: 48px; font-size: 12px; line-height: 16px; color: var(--muted); text-align: center; }
.auth__legal--tight { margin-top: 16px; }
.auth__legal .ulink { color: var(--ink); font-weight: 600; }

/* ---------- Fields ---------- */
.field { position: relative; margin-top: 50px; }
.auth__msg + .field { margin-top: 8px; }
.field__input {
  display: block; width: 100%; height: 48px; margin: 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 0;
  background: #fff; font: 400 16px/24px var(--font-ui); color: var(--ink); -webkit-appearance: none; appearance: none;
  transition: border-color .25s, box-shadow .4s var(--ease-out), padding .35s var(--ease-out);
}
.field__input::placeholder { color: var(--subtle); opacity: 1; transition: opacity .2s; }
.field__input:hover, .field__input:not(:placeholder-shown) { border-color: var(--disabled); }
.field__input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,55,255,.1); }
.field__input:focus::placeholder { opacity: 0; }
.field__label {
  position: absolute; left: 8px; top: 0; padding: 0 4px; background: #fff; pointer-events: none; white-space: nowrap;
  font: 400 10px/12px var(--font-ui); color: var(--body);
  opacity: 0; transform: translate(1px, 18px) scale(1.5); transform-origin: left center;
  transition: transform .45s var(--ease-out), opacity .25s, color .25s;
}
.field__input:focus ~ .field__label, .field__input:not(:placeholder-shown) ~ .field__label { opacity: 1; transform: translateY(-50%); }
.field__input:focus ~ .field__label { color: var(--blue); }
/* +91 prefix: shown once the phone field is focused or filled */
.field__prefix {
  position: absolute; left: 13px; top: 0; font: 400 16px/48px var(--font-ui); color: var(--ink); pointer-events: none;
  opacity: 0; transform: translateX(-6px); transition: opacity .25s, transform .4s var(--ease-out);
}
.field__input:focus ~ .field__prefix, .field__input:not(:placeholder-shown) ~ .field__prefix { opacity: 1; transform: none; }
.field--phone .field__input:focus, .field--phone .field__input:not(:placeholder-shown) { padding-left: 45px; }

.field.is-error .field__input { border-color: var(--red); }
.field.is-error .field__input:focus { box-shadow: 0 0 0 4px rgba(217,45,32,.1); }
.field.is-error .field__label { color: var(--red); }
.field.shake, .otp__boxes.shake { animation: shake .45s var(--ease-out); }
@keyframes shake { 15%, 55% { transform: translateX(-6px); } 35%, 75% { transform: translateX(5px); } 90% { transform: translateX(-2px); } }
.auth__msg { font-size: 12px; line-height: 16px; color: var(--red); }
.auth__msg:not(:empty) { margin-top: 6px; animation: auth-rise .35s var(--ease-out); }

/* Checkbox */
.check { display: flex; align-items: center; gap: 8px; width: fit-content; margin-top: 24px; font-size: 16px; line-height: 24px; color: var(--ink); cursor: pointer; }
.check input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.check__box {
  width: 20px; height: 20px; flex: none; display: grid; place-items: center; border: 1px solid var(--disabled); border-radius: 4px; background: #fff;
  transition: background .25s, border-color .25s, transform .35s var(--ease-spring);
}
.check__box svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 21; stroke-dashoffset: 21; transition: stroke-dashoffset .4s var(--ease-out) .05s; }
.check:hover .check__box { border-color: var(--muted); }
.check:active .check__box { transform: scale(.86); }
.check input:checked + .check__box { background: var(--blue); border-color: var(--blue); }
.check input:checked + .check__box svg { stroke-dashoffset: 0; }
.check input:focus-visible + .check__box { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- OTP ---------- */
.otp { margin-top: 47px; }
.otp__label { margin-bottom: 10px; font-size: 14px; line-height: 20px; color: var(--ink); }
.otp__boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.otp__box {
  width: 100%; height: 56px; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 0; background: #fff;
  font: 600 20px/1 var(--font-ui); color: var(--ink); text-align: center; caret-color: var(--muted); -webkit-appearance: none; appearance: none;
  transition: border-color .25s, background-color .35s, color .35s, box-shadow .4s var(--ease-out);
}
.otp__box:hover { border-color: var(--disabled); }
.otp__box:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,55,255,.1); }
.otp__box.pop { animation: digit-pop .35s var(--ease-spring); }
@keyframes digit-pop { from { transform: scale(.88); } }
.otp.is-error .otp__box { border-color: var(--red); }
.otp.is-error .otp__box:focus { box-shadow: 0 0 0 4px rgba(217,45,32,.1); }
.otp.is-ok .otp__box {
  border-color: var(--ok); background: var(--ok-bg); color: var(--ok-ink); cursor: default; box-shadow: none;
  transition-delay: calc(var(--i) * 55ms); animation: ok-pop .55s var(--ease-spring) backwards; animation-delay: calc(var(--i) * 55ms);
}
@keyframes ok-pop { 45% { transform: translateY(-4px) scale(1.06); } }

.auth__hint { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; line-height: 16px; color: var(--body); transition: color .25s; }
.auth__hint-ok { display: none; width: 12px; height: 12px; stroke-dasharray: 21; stroke-dashoffset: 21; }
.auth__hint.is-error { color: var(--red); }
.auth__hint.is-ok { color: var(--ok-ink); }
.auth__hint.is-ok .auth__hint-ok { display: block; animation: draw .5s var(--ease-out) .25s forwards; }

.auth__resend-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .5s var(--ease-out), opacity .3s; }
.auth__resend-wrap > div { min-height: 0; overflow: hidden; }
.auth__resend-wrap.is-gone { grid-template-rows: 0fr; opacity: 0; }
.auth__resend {
  display: block; height: 48px; margin: 8px auto 0; padding: 0 12px; font: 500 16px/24px var(--font-ui); color: var(--blue);
  transition: color .25s, opacity .25s;
}
.auth__resend:disabled { color: var(--subtle); cursor: default; }
.auth__resend.is-sending { opacity: .5; }

/* ---------- Buttons ---------- */
.auth__btn { width: 100%; margin-top: 8px; }
.auth__hint + .auth__btn, .check + .auth__btn, .auth__sub + .auth__btn { margin-top: 48px; }
.auth__btn .btn__label { display: inline-block; transition: opacity .2s, transform .35s var(--ease-out); }
.btn__label.is-out { opacity: 0; transform: translateY(-10px); }
.btn__label.is-in { animation: label-in .4s var(--ease-out); }
@keyframes label-in { from { opacity: 0; transform: translateY(10px); } }
.btn__spin {
  position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; opacity: 0; transform: scale(.5);
  transition: opacity .2s, transform .35s var(--ease-out);
}
.auth__btn.is-loading { pointer-events: none; }
.auth__btn.is-loading .btn__label { opacity: 0; transform: translateY(-10px); }
.auth__btn.is-loading .btn__spin { opacity: 1; transform: none; animation: auth-spin .7s linear infinite; }
@keyframes auth-spin { to { rotate: 360deg; } }
/* "Start shopping": the arrow slides in on hover */
.auth__btn--go .icon { width: 14px; height: 14px; margin-right: -24px; opacity: 0; transform: translateX(-10px); transition: margin .45s var(--ease-out), opacity .3s, transform .45s var(--ease-out); }
.auth__btn--go:hover .icon, .auth__btn--go:focus-visible .icon { margin-right: 0; opacity: 1; transform: none; }

/* ---------- Leaving without cross-page view transitions ---------- */
.auth.is-leaving .auth__card { animation: auth-card-out .32s cubic-bezier(.4,0,1,1) forwards; }
.auth.is-leaving .auth__scrim { animation: auth-fade-out .32s ease forwards; }
@keyframes auth-card-out { to { opacity: 0; transform: translateY(24px) scale(.98); } }
@keyframes auth-fade-out { to { opacity: 0; } }

/* Background stays still while the dialog arrives or leaves (see the main.css view transitions) */
::view-transition-old(root) { animation: none; }
::view-transition-new(root) { animation: auth-fade .35s ease both; }

/* =========================================================
   Mobile: bottom sheet
   ========================================================= */
@media (max-width: 767px) {
  .m-only { display: inline; }
  .d-only { display: none; }
  .auth { padding: 0; }
  .auth__card {
    margin: auto 0 0; width: 100%; max-height: calc(100% - 16px); overflow-y: auto; overscroll-behavior: contain;
    padding: 32px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -24px 60px -24px rgba(0,0,0,.45);
    animation-name: auth-sheet-in; animation-duration: .7s;
  }
  @keyframes auth-sheet-in { from { transform: translateY(100%); } }
  .auth.is-leaving .auth__card { animation-name: auth-sheet-out; }
  @keyframes auth-sheet-out { to { transform: translateY(100%); } }
  .auth__title { font-size: 18px; line-height: 24px; }
  .auth__sub { font-size: 12px; line-height: 16px; }
  .field, .otp { margin-top: 40px; }
  .auth__hint + .auth__btn, .check + .auth__btn, .auth__sub + .auth__btn, .auth__alt, .auth__legal { margin-top: 40px; }
  .auth__legal--tight { margin-top: 16px; }
}
