/* auth — phone + code scenes (module: auth). Fields/buttons are shared (shell.css). */

/* the outgoing .fg of the same-set swap sits on top of the incoming one, not beside it */
.fg.auth.out { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.fg.auth .kicker .num { color: var(--cream); font-weight: 600; letter-spacing: 0.06em; font-variant-numeric: tabular-nums lining-nums; }
.fg.auth .field.bad input { border-color: #f0a08a; }
.fg.auth .error { margin-top: 0; }

/* "Sending…": the CTA collapses into a 56px disc with a spinner (GSAP Flip morphs it) */
.btn .label { display: inline-block; }
.btn.sending { width: var(--control); min-width: var(--control); padding: 0; align-self: center; pointer-events: none; }
.btn.sending .label { display: none; }
.btn .spin { display: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(16, 24, 39, 0.16); border-top-color: var(--ink); }
.btn.sending .spin { display: block; }

/* six OTP cells with a real (invisible) input over them */
.cells { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 52px)); justify-content: space-between; gap: 6px; perspective: 500px; }
.cell {
  position: relative; height: 64px; border-radius: var(--r-s); display: grid; place-items: center;
  background: rgba(16, 24, 39, 0.62); border: 1px solid var(--cream-12); box-shadow: inset 0 1px 0 rgba(244, 238, 227, 0.08);
  font-family: var(--display); font-weight: 300; font-size: 32px; line-height: 1; color: var(--cream);
  font-variant-numeric: tabular-nums lining-nums; font-variation-settings: "opsz" 32;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; transform-style: preserve-3d;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.cell b { font-weight: inherit; }
.cell::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 8px; height: var(--hairline); background: var(--cream-30); transition: background 0.25s ease; }
.cell.on::after { background: var(--cream-60); animation: cellBlink 1s steps(2, start) infinite; }
.cell .caret { display: none; position: absolute; left: 50%; top: 18px; width: 1.5px; height: 28px; margin-left: -1px; background: var(--clay); }
.cells.focus .cell.on .caret { display: block; animation: cellBlink 1s steps(2, start) infinite; }
@keyframes cellBlink { 50% { opacity: 0; } }
.cells.bad .cell::after, .cells.bad .cell.on::after { background: #f0a08a; animation: none; }
.cell.ok { background: var(--clay); border-color: var(--clay); color: var(--cream); box-shadow: inset 0 1px 0 rgba(244, 238, 227, 0.2); }
.cell.ok::after { background: rgba(244, 238, 227, 0.4); }
.cells .otp {
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; outline: 0; border-radius: var(--r-s);
  opacity: 0; font-size: 16px; color: transparent; caret-color: transparent; background: transparent; -webkit-appearance: none; appearance: none;
}
.fg.auth .otp-status { min-height: 1.4em; margin: 0; max-width: none; }
.fg.auth .otp-status.error { color: #f0a08a; }
.fg.auth .link:disabled { opacity: 0.5; cursor: wait; }

/* success: the CTA turns clay and a check draws itself */
.btn .check { display: none; width: 24px; height: 24px; }
.btn .check svg { display: block; width: 100%; height: 100%; }
.btn .check path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.btn.ok { background: var(--clay); color: var(--cream); pointer-events: none; }
.btn.ok .label { display: none; }
.btn.ok .check { display: block; }

@media (prefers-reduced-motion: reduce) {
  .cell.on::after, .cells.focus .cell.on .caret { animation: none; }
  .cell { transition: none; }
}

/* delight's light sweep (.cta-sheen) must not be caught inside the disc while the CTA Flips into the spinner */
.btn.sending .cta-sheen, .btn.ok .cta-sheen { display: none; }

/* A small embossed seal and ruled stationery frame keep the gate composed at every height. */
.auth-scene { background: #30241f; }
.auth-scene .bg { opacity: 0.28; }
.auth-scene .bg.bokeh img { filter: blur(7px) saturate(0.75) sepia(0.3); }
.auth-scene::after { content: ""; position: absolute; inset: calc(var(--safe-top) + 83px) 13px calc(var(--safe-bottom) + 16px); z-index: 1; pointer-events: none; border: 1px solid rgba(223, 194, 150, 0.22); border-radius: 150px 150px 4px 4px; }
.fg.auth.bottom { justify-content: center; padding: calc(var(--safe-top) + 112px) 30px calc(var(--safe-bottom) + 48px + var(--kb)); }
.fg.auth > .kicker { text-align: center; color: #dec9a7; margin-bottom: 19px; }
.fg.auth > .title { font-size: clamp(40px, 8.6vw, 60px); line-height: 1.06; letter-spacing: -0.035em; text-align: center; text-wrap: balance; max-width: 100%; }
.fg.auth > form { width: 100%; margin-top: 36px; gap: 14px; }
.fg.auth form > .sub { width: 100%; max-width: none; margin-top: 8px; color: rgba(244, 238, 227, 0.75); line-height: 1.65; text-wrap: wrap; }
.fg.auth .field > .label { color: #dec9a7; font-size: 9.5px; letter-spacing: 0.18em; margin-left: 0; }
.fg.auth .phone-row input { border-radius: 4px; border-color: rgba(223, 194, 150, 0.38); background: rgba(244, 238, 227, 0.055); font-size: 17px; padding-inline: 14px; }
.fg.auth .phone-row input::placeholder { color: rgba(244, 238, 227, 0.45); }
.fg.auth form > .btn { border-radius: 5px; box-shadow: 0 2px 0 rgba(255, 255, 255, 0.15) inset, 0 7px 22px rgba(0, 0, 0, 0.13); }
.fg.auth form > .btn.sending { border-radius: 50%; }
.fg.auth .error:empty { display: none; }
.auth-gate { position: relative; display: grid; place-items: center; align-self: center; flex-shrink: 0; width: 48px; height: 48px; margin-bottom: 25px; color: #dec9a7; border: 1px solid rgba(223, 194, 150, 0.48); border-radius: 50%; background: linear-gradient(145deg, rgba(244, 238, 227, 0.12), rgba(223, 194, 150, 0.025)); box-shadow: 0 0 0 5px rgba(223, 194, 150, 0.035), inset 0 1px 1px rgba(244, 238, 227, 0.1); }
.auth-gate::before, .auth-gate::after { content: ""; position: absolute; width: 38px; height: 1px; top: 50%; background: linear-gradient(90deg, transparent, rgba(223, 194, 150, 0.4)); }
.auth-gate::before { right: calc(100% + 15px); }
.auth-gate::after { left: calc(100% + 15px); transform: rotate(180deg); }
.auth-gate svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.auth-gate.unlocked { color: var(--cream); border-color: var(--clay); background: var(--clay); }
.phone-field > .label { display: block; }
.phone-row { display: flex; gap: 8px; align-items: stretch; }
.phone-row input { flex: 1; min-width: 0; width: 0; }
.country-button { flex-shrink: 0; min-height: var(--control); display: flex; align-items: center; gap: 7px; padding: 0 10px; color: var(--cream); background: rgba(244, 238, 227, 0.055); border: 1px solid rgba(223, 194, 150, 0.38); border-radius: 4px; cursor: pointer; font: inherit; font-size: 14px; }
.country-button:focus-visible, .country-option:focus-visible, .country-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.country-flag { font-size: 21px; line-height: 1; }
.country-chevron { color: var(--cream-60); font-size: 16px; }
.phone-field.bad .country-button { border-color: #f0a08a; }
.country-picker { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; padding: calc(var(--safe-top) + 24px) 18px calc(var(--safe-bottom) + 24px); background: rgba(5, 8, 15, 0.8); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.country-panel { display: flex; flex-direction: column; width: 100%; max-height: min(590px, 100%); min-height: 0; padding: 20px; color: var(--ink); background: var(--paper); border: 1px solid rgba(255, 255, 255, 0.35); border-radius: var(--r-l); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4); }
.country-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.country-head h2 { font-family: var(--display); font-size: 29px; letter-spacing: -0.03em; font-weight: 300; }
.country-close { width: 44px; height: 44px; flex-shrink: 0; border: 1px solid rgba(16, 24, 39, 0.15); border-radius: 50%; background: transparent; color: var(--ink); font-size: 25px; cursor: pointer; }
.country-search { width: 100%; min-width: 0; flex-shrink: 0; padding: 14px 12px; border: 1px solid rgba(16, 24, 39, 0.22); border-radius: var(--r-s); background: rgba(255, 255, 255, 0.5); font: inherit; font-size: 16px; color: var(--ink); }
.country-search:focus { outline: 2px solid var(--clay); outline-offset: 1px; }
.country-results { min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-top: 12px; }
.country-option { display: flex; align-items: center; width: 100%; min-height: 52px; padding: 10px; gap: 12px; color: var(--ink); border: 0; border-radius: var(--r-s); background: transparent; text-align: left; cursor: pointer; font: inherit; font-size: 14px; }
.country-option.selected { background: rgba(210, 104, 74, 0.13); }
.country-option:hover { background: rgba(16, 24, 39, 0.07); }
.country-name { flex: 1; }
.country-option .num { color: var(--ink-3); }
.country-empty { padding: 20px 0; font-size: 14px; }
.country-empty[hidden] { display: none; }
@media (max-height: 680px) { .auth-gate { width: 44px; height: 44px; margin-bottom: 12px; } .auth-gate svg { width: 24px; height: 24px; } }

.country-picker { bottom: var(--kb); }
.kb .fg.auth .auth-gate { display: none; }
.kb .fg.auth .title { font-size: 28px; margin-bottom: 20px; }
.kb .fg.auth .sub { font-size: 12px; }
.kb .fg.auth .cell { height: 54px; }

.auth-scene .cells { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.auth-scene .cell { border-radius: 4px; border-color: rgba(223, 194, 150, 0.3); background: rgba(244, 238, 227, 0.055); }
.auth-scene .cell.ok { background: var(--clay); border-color: var(--clay); }
.fg.auth .row.between { gap: 8px; }
@media (min-width: 500px) and (max-width: 759px) {
  .fg.auth.bottom { padding-inline: 52px; }
  .fg.auth > .title { font-size: 64px; }
  .fg.auth > form { margin-top: 46px; gap: 18px; }
  .fg.auth .phone-row input { font-size: 20px; }
  .fg.auth .field > .label { font-size: 11px; }
  .fg.auth form > .sub { font-size: 15px; }
  .auth-gate { width: 54px; height: 54px; margin-bottom: 30px; }
}
@media (max-height: 700px) {
  .fg.auth.bottom { padding-top: 90px; padding-bottom: calc(30px + var(--kb)); }
  .fg.auth > .title { font-size: 34px; }
  .fg.auth > form { margin-top: 24px; gap: 10px; }
  .auth-gate { margin-bottom: 16px; }
}
.kb .fg.auth.bottom { justify-content: flex-end; padding-top: 70px; padding-bottom: calc(24px + var(--kb)); }
.kb .fg.auth > .kicker { margin-bottom: 12px; }
.kb .fg.auth > form { margin-top: 20px; gap: 10px; }
.kb .fg.auth .title { font-size: 28px; margin-bottom: 0; }

.fg.auth form > .btn.auth-preview { background: transparent; border: 1px solid rgba(223, 194, 150, 0.4); color: #dec9a7; box-shadow: none; font-size: 10px; min-height: 44px; letter-spacing: 0.15em; }
.fg.auth form > .btn.auth-preview:disabled { opacity: 0.55; cursor: wait; }

/* Only actionable controls remain in a recovery state. */
.auth-scene .auth [hidden] { display: none !important; }
.auth-scene.auth-recovery .otp-status { text-align: center; }
.fg.auth .field + .error { font-size: 13px; line-height: 1.55; }
