/* The site's own palette (site/app/globals.css), so leaving the site for this
   page doesn't feel like leaving Arca. System fonts only: the CSP allows no
   webfont, and Geist is drawn after the SF anyway. */

:root {
  --page: #0b0e14;
  --card: #1c1b20;
  --fg: #e7e5ec;
  --fg-2: rgb(231 229 236 / 0.64);
  --fg-3: rgb(231 229 236 / 0.56);
  --hairline: rgb(255 255 255 / 0.08);
  --field: rgb(255 255 255 / 0.06);
  --focus: #ffbe6e;
  --field-focus: #ffbe6e;
  --danger: #ff453a;
  --ok: #4cc38a;
  --mark: #ffbe6e;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --page: #fbfaf8;
    --card: #ffffff;
    --fg: #26242c;
    --fg-2: rgb(38 36 44 / 0.76);
    --fg-3: rgb(38 36 44 / 0.64);
    --hairline: rgb(0 0 0 / 0.08);
    --field: rgb(0 0 0 / 0.045);
    --focus: #c9382a;
    /* Ink, not ember: in light the ember is also the error red. */
    --field-focus: rgb(38 36 44 / 0.72);
    --danger: #c9382a;
    --ok: #1a7f4b;
    --mark: #c9382a;
    color-scheme: light;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 16px;
  background: var(--page);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.mark {
  color: var(--mark);
  flex: none;
}

main {
  width: 100%;
  max-width: 400px;
  padding: 32px 28px 28px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
}

h1 {
  margin: 0 0 8px;
  font-family: ui-serif, "New York", Georgia, serif;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 450;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 16px;
}

.lead,
.note,
.account {
  color: var(--fg-2);
}

.note {
  font-size: 14px;
  line-height: 20px;
}

.noscript {
  max-width: 400px;
  text-align: center;
  color: var(--fg-2);
}

form,
section {
  margin-top: 20px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
}

input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  margin-bottom: 16px;
  font: inherit;
  font-size: 16px;
  color: inherit;
  background: var(--field);
  border: 1px solid color-mix(in oklab, var(--fg) 18%, transparent);
  border-radius: 10px;
}

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

/* A soft halo, like the macOS ring, so a focused field never reads as an error. */
input:focus-visible {
  outline: none;
  border-color: var(--field-focus);
  box-shadow: 0 0 0 1px var(--field-focus), 0 0 0 4px color-mix(in oklab, var(--field-focus) 22%, transparent);
}

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

input[aria-invalid="true"]:focus-visible {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger), 0 0 0 4px color-mix(in oklab, var(--danger) 22%, transparent);
}

input.code-input {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 24px;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
}

button,
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0 20px;
  margin-bottom: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-radius: 11px;
  cursor: pointer;
}

/* .btn-primary of the site. */
.primary {
  color: #1a0d08;
  background: linear-gradient(180deg, #ff9b63 0%, #fa8548 48%, #ee7137 100%);
  border: 1px solid #d26735;
  border-top-color: #ffb689;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.36),
    inset 0 -1px 0 rgb(148 53 14 / 0.16),
    0 2px 0 #ac4b23,
    0 5px 10px -4px rgb(83 31 10 / 0.3);
}

/* .btn-secondary of the site. */
.secondary {
  color: var(--fg);
  border: 1px solid color-mix(in oklab, var(--fg) 18%, var(--card));
  background: linear-gradient(180deg, color-mix(in oklab, var(--fg) 8%, var(--card)), color-mix(in oklab, var(--fg) 3%, var(--card)));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.12),
    0 2px 0 color-mix(in oklab, var(--card) 80%, #000),
    0 4px 8px -4px rgb(0 0 0 / 0.2);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

button.link {
  display: inline-flex;
  width: auto;
  min-height: 44px;
  padding: 0;
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--fg-2);
  background: none;
  border: 0;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in oklab, currentColor 45%, transparent);
}

#other-account,
#logout,
#back-login {
  margin-top: 4px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.error {
  margin: 16px 0 0;
  color: var(--danger);
  font-size: 14px;
  line-height: 20px;
}

/* Under the field it's about, before the button. */
input + .error,
.pw + .error {
  margin: -8px 0 16px;
}

/* A notice from the URL (a provider that failed) opens the form. */
form > .error:first-child {
  margin: 0 0 16px;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
  main {
    animation: fade-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  @keyframes fade-in {
    from {
      opacity: 0;
    }
  }
}

/* Sprite for <use>: present in the DOM, never laid out. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.pw {
  position: relative;
  margin-bottom: 16px;
}

.pw input {
  margin-bottom: 0;
  padding-right: 48px;
}

button.reveal {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  color: var(--fg-2);
  background: none;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
}

button.reveal svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button.reveal .eye-off,
button.reveal[aria-pressed="true"] .eye {
  display: none;
}

button.reveal[aria-pressed="true"] .eye-off {
  display: inline;
}

/* "Esqueci a senha", tucked under the password field. */
.aside {
  display: flex;
  justify-content: flex-end;
  margin: -12px 0 4px;
}

.hint {
  margin: -8px 0 16px;
}

.hint[data-state="ok"] {
  color: var(--ok);
}

.hint[data-state="ok"]::before {
  content: "✓ ";
}

.hint[data-state="bad"] {
  color: var(--danger);
}

.legal {
  margin: 4px 0 8px;
  text-align: center;
  text-wrap: balance;
}
.legal a {
  color: inherit;
  text-underline-offset: 3px;
}
.legal a:hover,
.legal a:focus-visible {
  color: var(--fg);
}

.switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: 6px;
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--fg-2);
}

.switch .link {
  color: var(--fg);
}

.providers .or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
  font-size: 13px;
  color: var(--fg-3);
}

.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in oklab, var(--fg) 14%, transparent);
}

.icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-right: 10px;
  fill: currentColor;
}

/* Brand rule: the Google "G" sits on white with a hairline border. */
.provider-google {
  color: #1f1f1f;
  background: #fff;
  border: 1px solid #dadce0;
}
