/* Sign-in pages: Twitch or email, and the six-digit code. Loaded on those pages only. */

body.signin {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--cobalt);
  color: var(--white);
}

.signin-main {
  flex: 1;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 18px;
  width: min(100% - 32px, 480px);
  margin: 4vh auto 48px;
}

.signin-card {
  position: relative;
  width: 100%;
  padding: 44px 32px 32px;
  border: 2px solid var(--bar);
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--bar);
}

/* The card's label sits on its top edge as a black bar, like the one in the wordmark. */
.signin-tab {
  position: absolute;
  top: -2px;
  left: -2px;
  margin: 0;
  padding: 6px 12px 7px;
  background: var(--bar);
  color: var(--white);
  font-size: 0.8125rem;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.signin-card h1 {
  font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.25rem);
  margin-bottom: 10px;
}

.signin-lede {
  color: var(--muted);
}

.signin-address {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.signin-card .notice {
  margin-top: 18px;
}

.signin-way {
  display: grid;
  gap: 8px;
  margin-top: 26px;
}

.signin-way .btn,
.signin-form .btn {
  width: 100%;
  min-height: 52px;
}

/* Twitch's own purple would fight the page; the brand's black keeps the yellow for the email button. */
.signin-twitch {
  background: var(--bar);
  color: var(--white);
}

.signin-twitch:hover {
  background: #1f2433;
}

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

.signin-small {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 2px solid var(--line);
}

/* "or with your email", centred on a rule. */
.signin-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 4px;
  max-width: none;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.signin-or::before,
.signin-or::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--line);
}

.signin-form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.signin-form > label {
  font-weight: 700;
}

.signin-form .text-input {
  min-height: 52px;
  font-size: 1.0625rem;
}

.signin-form .cf-turnstile {
  min-height: 65px;
}

.signin-foot {
  display: flex;
  gap: 18px;
  font-size: 0.875rem;
  font-weight: 600;
}

.signin-foot a {
  color: var(--white);
}

/* ---------- the six-digit code ---------- */

/* Without the script this is one plain, large box. */
.code-entry {
  position: relative;
}

.code-entry input {
  width: 100%;
  height: 68px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4em;
  text-align: center;
}

.code-cells {
  display: none;
}

/* With the script: six boxes drawn under a real, invisible input that keeps focus, pasting and autofill. */
.code-entry.live input {
  position: absolute;
  inset: 0;
  z-index: 1;
  height: 100%;
  border-color: transparent;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  outline: none;
}

.code-entry.live input::selection {
  background: transparent;
}

.code-entry.live .code-cells {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.code-cell {
  display: grid;
  place-items: center;
  height: 68px;
  border: 2px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-size: 2rem;
  font-weight: 800;
  font-stretch: 125%;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* A gap after the third box, so the code reads as two groups of three. */
.code-cell:nth-child(3) {
  margin-right: 10px;
}

.code-cell.full {
  background: var(--paper);
}

/* The box the next digit goes into, while the field has focus. */
.code-cell.next {
  background: var(--signal);
}

.code-cell.next::after {
  content: '';
  width: 3px;
  height: 1.1em;
  background: var(--bar);
  animation: code-caret 1s steps(1) infinite;
}

.code-cell.next.full::after {
  display: none;
}

@keyframes code-caret {
  50% {
    opacity: 0;
  }
}

.code-entry:focus-within .code-cells {
  outline: 3px solid var(--signal);
  outline-offset: 4px;
}

/* After a wrong code: the boxes, or the plain box when there is no script, turn red. The
   invisible input over the boxes keeps its transparent border. */
.code-entry.bad .code-cell,
.code-entry.bad:not(.live) input {
  border-color: var(--danger);
}

.signin-again {
  display: grid;
  justify-items: start;
  gap: 8px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 2px solid var(--line);
  font-size: 0.9375rem;
}

.signin-again p {
  color: var(--muted);
}

.signin-again a {
  font-weight: 600;
  color: var(--cobalt);
}

@media (max-width: 520px) {
  .signin-card {
    padding: 40px 18px 22px;
  }

  .code-entry.live .code-cells {
    gap: 5px;
  }

  .code-cell,
  .code-entry input {
    height: 58px;
    font-size: 1.625rem;
  }

  .code-cell:nth-child(3) {
    margin-right: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .code-cell.next::after {
    animation: none;
  }
}

/* Google's own pre-approved button image, unaltered, as tall as the Twitch button. */
.signin-google {
  display: inline-block;
  justify-self: center;
  line-height: 0;
}

.signin-google img {
  width: auto;
  height: 52px;
}

.signin-google:focus-visible {
  outline: 3px solid var(--signal, #ffd23f);
  outline-offset: 3px;
}
