/* Hosted sign-in pages. Colours, font and radius come from the realm's theme.css. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  /* biome-ignore lint/complexity/noImportantStyles: hidden must beat display rules on classes like .stack */
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

.gate,
.foot {
  width: min(100% - 2.5rem, 25rem);
  margin-inline: auto;
}

.gate {
  padding-block: clamp(3rem, 14vh, 8rem) 2.5rem;
}

/* The ring: the one ornament. Its arc shows how far through signing in the person is. */
.mark {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
  display: grid;
  place-items: center;
}

.ring {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
  fill: none;
}

.ring-track {
  stroke: var(--border);
  stroke-width: 1.5;
  opacity: 0.6;
}

.ring-arc {
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 188.5;
  stroke-dashoffset: 125.7;
  transition: stroke-dashoffset 700ms cubic-bezier(0.3, 0.7, 0.2, 1);
}

[data-step="2"] .ring-arc {
  stroke-dashoffset: 62.8;
}

[data-step="3"] .ring-arc {
  stroke-dashoffset: 0;
}

.logo {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: contain;
}

.initial {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text);
}

.product {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

h1 {
  margin: 0.25rem 0 1.75rem;
  font-size: 1.75rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1:focus {
  outline: none;
}

h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.stack > h2:first-child {
  margin-top: 0;
}

.lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

/* The live region always exists so every message is announced; it takes no space when empty. */
.status:empty {
  margin: 0;
  padding: 0;
  border: 0;
}

.status {
  margin: 0 0 1.25rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--danger);
  color: var(--danger);
}

.status.ok {
  border-left-color: var(--accent);
  color: var(--text);
}

.stack {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.375rem;
}

label {
  font-size: 0.9375rem;
  font-weight: 500;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

input {
  width: 100%;
  min-height: 2.875rem;
  padding: 0 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input.code {
  font-size: 1.25rem;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

button {
  font: inherit;
  cursor: pointer;
}

.primary,
.secondary {
  width: 100%;
  min-height: 2.875rem;
  padding: 0 1rem;
  border-radius: var(--radius);
  font-weight: 600;
}

.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.secondary {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.primary:hover {
  filter: brightness(1.08);
}

.secondary:hover,
.option:hover {
  border-color: var(--accent);
}

button[aria-busy="true"] {
  cursor: progress;
  opacity: 0.7;
}

.link {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  opacity: 0.6;
}

.aside {
  margin: 1.5rem 0 0;
}

.aside a {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  color: var(--text);
}

.switch {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.options {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.option {
  width: 100%;
  display: grid;
  gap: 0.125rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.option-name {
  font-weight: 600;
}

.option-hint {
  color: var(--muted);
  font-size: 0.875rem;
}

.qr {
  width: 11rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: #ffffff;
}

.qr img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.key summary {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  color: var(--muted);
  cursor: pointer;
}

.key code {
  display: block;
  padding: 0.5rem 0;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 1.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
}

.rows {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.row {
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
}

.row > span:first-child {
  display: grid;
}

.row-meta {
  color: var(--muted);
  font-size: 0.875rem;
}

.foot {
  padding-block: 1.5rem 2rem;
  font-size: 0.875rem;
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.foot a {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .ring-arc {
    transition: none;
  }
}
