/* ---------- Sign in with a QR code ----------
   Three places: the button on /signin, the computer's code page
   (qr_sign_ins/show), and the phone's confirm page (qr_approvals/show).
   QrSignIn explains the flow. */

/* The button on /signin. It owns the "or" while it shows, so the provider
   block under it drops its own and closes up to the provider buttons' gap.
   A phone gets neither change: it cannot scan its own screen, so the button
   goes and the providers keep their "or". Two classes on each rule, to beat
   signin.css's .signin-sso and .signin-or, which load after this file. */
@media (max-width: 767px) {
  .signin .signin-qr { display: none; }
}
@media (min-width: 768px) {
  .signin .signin-qr + .signin-sso { margin-top: -10px; }
  .signin .signin-qr + .signin-sso .signin-or { display: none; }
}

/* ---------- The computer's page ----------
   The login card, widened for two columns: the code, and how to use it. */
.qr-wrap { max-width: 760px; }
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 24px; }
@media (min-width: 640px) {
  .qr-card { flex-direction: row; gap: 36px; }
}

.qr-code { flex: none; display: flex; flex-direction: column; align-items: center; }
/* Nested radii: the tile's 16px plus the frame's 10px of padding. */
.qr-frame { position: relative; padding: 10px; border: 1px solid var(--line); border-radius: 26px; background: var(--bg); }
.qr-tile {
  position: relative; width: 216px; height: 216px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px; background: var(--card); color: var(--navy);
}
.qr-tile > svg { width: 100%; height: 100%; transition: opacity var(--ease), filter var(--ease); }

/* Each status, off the attribute the Stimulus controller keeps. The code
   fades back so whatever sits on it reads. */
[data-qr-sign-in-status-value="scanned"] .qr-tile > svg { opacity: .15; filter: blur(2px); }
[data-qr-sign-in-status-value="confirmed"] .qr-tile > svg { opacity: .1; filter: blur(3px); }
[data-qr-sign-in-status-value="expired"] .qr-tile > svg { opacity: .25; filter: blur(4px); }

.qr-badge, .qr-refresh-form { display: none; position: absolute; }
.qr-badge { align-items: center; justify-content: center; }
.qr-badge svg { width: 28px; height: 28px; }
.qr-badge-scanned {
  width: 56px; height: 56px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); box-shadow: var(--shadow-lg);
}
.qr-badge-confirmed { width: 64px; height: 64px; border-radius: 999px; background: var(--blue); color: var(--on-blue); }
[data-qr-sign-in-status-value="scanned"] .qr-badge-scanned { display: flex; animation: qr-wiggle .6s ease-in-out 2; }
[data-qr-sign-in-status-value="confirmed"] .qr-badge-confirmed { display: flex; animation: qr-stamp .42s cubic-bezier(.2, .8, .2, 1) both; }
[data-qr-sign-in-status-value="expired"] .qr-refresh-form { display: block; }

.qr-refresh {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--card); color: var(--navy);
  font-family: var(--font-head); font-weight: 500; font-size: .8125rem; cursor: pointer;
  box-shadow: var(--shadow-lg); transition: border-color var(--ease), background var(--ease);
}
.qr-refresh:hover { border-color: var(--blue); background: var(--blue-soft); }
.qr-refresh svg { width: 14px; height: 14px; }

.qr-countdown {
  position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%);
  padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  white-space: nowrap; font-size: .75rem; color: var(--muted-2); font-variant-numeric: tabular-nums;
}
.qr-status { margin: 24px 0 0; max-width: 236px; min-height: 2.9em; text-align: center; font-size: .875rem; color: var(--muted); }

.qr-guide { flex: 1; min-width: 0; }
.qr-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.qr-steps li { display: flex; align-items: center; gap: 12px; font-size: .93rem; color: var(--muted-2); }
.qr-step-num {
  flex: none; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 999px; font-size: .75rem; font-weight: 500;
}
.qr-step-num svg { display: none; width: 14px; height: 14px; }

/* Waiting, the first step is the one to do. Scanned, the first two are done
   and Confirm is next. Confirmed, all three are done. Expired, none is. */
[data-qr-sign-in-status-value="waiting"] .qr-steps li:first-child,
[data-qr-sign-in-status-value="scanned"] .qr-steps li,
[data-qr-sign-in-status-value="confirmed"] .qr-steps li { color: var(--navy); }
[data-qr-sign-in-status-value="waiting"] .qr-steps li:first-child .qr-step-num,
[data-qr-sign-in-status-value="scanned"] .qr-step-num,
[data-qr-sign-in-status-value="confirmed"] .qr-step-num { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
[data-qr-sign-in-status-value="scanned"] li:nth-child(-n+2) .qr-step-num span,
[data-qr-sign-in-status-value="confirmed"] .qr-step-num span { display: none; }
[data-qr-sign-in-status-value="scanned"] li:nth-child(-n+2) .qr-step-num svg,
[data-qr-sign-in-status-value="confirmed"] .qr-step-num svg { display: block; }

/* Each move confirms a status change and plays once. base.css cuts both
   to nothing under reduced motion. */
@keyframes qr-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}
@keyframes qr-stamp {
  from { opacity: 0; transform: scale(.75) rotate(-12deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* ---------- The phone's confirm page ----------
   Signed in, so it sits in the app's container, capped and centred as the
   claim card is. Two or three facts in a plain list, the buttons, and the
   one warning in muted type under them: a sign-in prompt, not a notice. */
.app-main .qr-confirm { max-width: 440px; margin: 0 auto; }
.qr-facts {
  display: grid; grid-template-columns: auto 1fr; gap: 0 18px;
  margin: 0 0 4px; font-size: .93rem;
}
.qr-facts dt { color: var(--muted); padding: 10px 0; border-bottom: 1px solid var(--line); }
.qr-facts dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 500; }
.qr-facts dt:last-of-type, .qr-facts dd:last-of-type { border-bottom: 0; }
.qr-note { margin: 18px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
