/* Additions on top of login-app.css for the Razor port:
 * - hero-copy cross-fade (the React build re-mounted on slide change;
 *   the static template needs explicit opacity transitions).
 * - a couple of utility helpers the server-rendered markup leans on.
 */

/* The HTML `hidden` attribute must win over component display rules.
 * `.btn { display: inline-flex }` (and the icon/rule spans) otherwise
 * override the UA `[hidden] { display:none }`, which would leak the
 * programmatic SSO submit button and the toggle's off-state icons. */
[hidden] { display: none !important; }

/* The prototype toggles a `.focused` class on .input-wrap via React to get
 * the orange focus underline. The server-rendered inputs have no such JS, so
 * drive the same focus treatment with :focus-within. Use an inset box-shadow
 * (not border-bottom-color): the base `border: …var()` shorthand blocks a
 * border-color override from winning the cascade in Blink. */
.input-wrap:focus-within {
  box-shadow: inset 0 -2px 0 0 var(--xp-orange-500);
}

/* The React demo only renders the validation slot on error; the server markup
 * always includes an (empty) one, whose margin-top + min-height added ~20px
 * below every field. Collapse it when there's no message so field/button
 * spacing matches the demo, and restore the spacing only when an error shows. */
.field .input-feedback { margin-top: 0; min-height: 0; }
.field .input-feedback:has(.field-validation-error) { margin-top: 6px; min-height: 14px; }

.hero-body .hero-copy {
  position: absolute;
  inset: auto auto 24px 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  pointer-events: none;
  max-width: 480px;
}
.hero-body .hero-copy.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  position: relative;
  inset: auto;
}

/* Tame the legacy .ico inline svg colour bleed inside the success-icon  */
.success-icon svg.ico { stroke: var(--xp-success-700); }

/* anchor styled as a button needs explicit text-decoration reset */
a.btn { text-decoration: none; }
a.btn:hover { text-decoration: none; }

/* ============================================================
 * Two-factor — segmented one-time-code input
 * ============================================================ */
/* The brand-tinted header circle (vs. the green success-icon). */
.success-icon.brand { background: #fff4e0; }
.success-icon.brand .ico { color: var(--xp-orange-700); }
.success-icon.brand::after { border-color: #f3d9a8; }

.otp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 2px;
}
.otp-sep {
  width: 10px;
  height: 2px;
  background: var(--xp-border);
  border-radius: 2px;
  flex-shrink: 0;
}
.otp-cell {
  width: 44px;
  height: 52px;
  border: 1px solid var(--xp-border);
  border-radius: var(--xp-radius);
  background: var(--xp-bg);
  text-align: center;
  font-family: var(--xp-font-sans);
  font-size: 22px;
  font-weight: 600;
  color: var(--xp-text);
  caret-color: var(--xp-orange-500);
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
  -moz-appearance: textfield;
}
.otp-cell::-webkit-outer-spin-button,
.otp-cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.otp-cell:hover { border-color: #c4c4c4; }
.otp-cell:focus {
  outline: none;
  border-color: var(--xp-orange-500);
  box-shadow: inset 0 -2px 0 0 var(--xp-orange-500), 0 0 0 3px rgba(245,156,8,0.12);
}
.otp-cell.filled { border-color: #c4c4c4; }
.otp.invalid .otp-cell { border-color: var(--xp-danger-500); }

/* When JS is present, the single-input fallback is hidden and the segmented
   boxes drive a hidden bound field. Without JS, show the fallback and hide
   the decorative boxes. */
html.js .otp-fallback { display: none; }
html:not(.js) .otp { display: none; }

.otp-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}
.otp-actions form { display: inline-flex; }
.otp-actions .text-link[disabled] {
  opacity: 0.5;
  pointer-events: none;
}
.otp-actions-sep {
  width: 1px;
  height: 12px;
  background: var(--xp-border);
}

/* ============================================================
 * Single-page reveal — password step appears when the
 * identifier field loses focus. JS-only collapse (no-JS shows all).
 * ============================================================ */
html.js .reveal-section:not(.is-revealed) {
  display: none;
}
/* When JS is present, the no-JS submit becomes the "Continue" button
   (revealed by JS, see login.js). */
.reveal-section.is-revealed {
  animation: reveal-step 0.34s cubic-bezier(.4, 0, .2, 1);
}
@keyframes reveal-step {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .reveal-section.is-revealed { animation: none; }
}

/* ============================================================
 * Two-factor SETUP — authenticator enrolment
 * (numbered steps, QR frame, monospace setup key, recovery codes)
 * ============================================================ */
.form-card.setup-card { max-width: 344px; }

.setup-steps {
  list-style: none;
  counter-reset: step;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.setup-steps li {
  position: relative;
  padding-left: 34px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--xp-text-muted);
  counter-increment: step;
}
.setup-steps li strong { color: var(--xp-text); font-weight: 600; }
.setup-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff4e0;
  color: var(--xp-orange-700);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-block {
  display: flex;
  justify-content: center;
  margin: 0 0 20px;
}
.qr-frame {
  width: 184px;
  height: 184px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--xp-border);
  border-radius: var(--xp-radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-frame svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Monospace, readonly setup key inside the standard .input-wrap. */
.key-input {
  all: unset;
  flex: 1;
  min-width: 0;
  height: 100%;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--xp-text);
}

/* One-time recovery codes shown after enabling. */
.recovery-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 20px;
}
.recovery-codes .rc {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--xp-text);
  background: var(--xp-bg-alt);
  border: 1px solid var(--xp-border);
  border-radius: var(--xp-radius);
  padding: 8px 10px;
  text-align: center;
}
