:root {
  color-scheme: light dark;
  --paper: #f5f1e8;
  --paper-raised: #fbf8f1;
  --ink: #1b1b19;
  --ink-muted: #6d685f;
  --line: #cfc7ba;
  --line-strong: #999184;
  --crimson: #b0232f;
  --crimson-dark: #7f1721;
  --graphite: #242422;
  --graphite-muted: #aaa398;
  --success: #52634d;
  --danger: #a22a33;
  --panel-width: 640px;
  --panel-gutter: clamp(28px, 3.5vw, 48px);
  --font-ui: Inter, "Segoe UI Variable", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    linear-gradient(90deg, transparent calc(100% - 1px), rgba(27, 27, 25, .045) calc(100% - 1px)) 0 0 / 48px 48px,
    linear-gradient(transparent calc(100% - 1px), rgba(27, 27, 25, .035) calc(100% - 1px)) 0 0 / 48px 48px,
    var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(280px, 34vw) minmax(0, 1fr);
}

.auth-context {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(30px, 5vw, 72px);
  overflow: hidden;
  background: var(--graphite);
  color: var(--paper);
  border-right: 1px solid #0f0f0e;
}

.auth-context::before,
.auth-context::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.auth-context::before {
  inset: 0;
  opacity: .22;
  background:
    linear-gradient(125deg, transparent 0 49.7%, rgba(245, 241, 232, .13) 49.8% 50%, transparent 50.1%),
    linear-gradient(90deg, transparent calc(100% - 1px), rgba(245, 241, 232, .08) calc(100% - 1px)) 0 0 / 64px 64px,
    linear-gradient(transparent calc(100% - 1px), rgba(245, 241, 232, .06) calc(100% - 1px)) 0 0 / 64px 64px;
}

.auth-context::after {
  width: clamp(180px, 24vw, 420px);
  aspect-ratio: 1;
  right: -18%;
  bottom: 8%;
  border: 1px solid rgba(214, 66, 79, .55);
  border-radius: 50%;
  box-shadow:
    0 0 0 24px rgba(214, 66, 79, .035),
    0 0 0 72px rgba(214, 66, 79, .025);
}

.brand-link,
.context-index,
.context-copy,
.context-rule {
  position: relative;
  z-index: 1;
}

.brand-link {
  display: inline-flex;
  align-self: flex-start;
  color: inherit;
}

.brand-link img {
  display: block;
  width: min(216px, 70vw);
  height: auto;
}

.context-index {
  margin-top: clamp(70px, 16vh, 170px);
  color: var(--graphite-muted);
  font: 500 11px/1 var(--font-mono);
  letter-spacing: .16em;
}

.context-copy {
  max-width: 430px;
  margin-top: 26px;
}

.context-kicker {
  margin: 0 0 18px;
  color: #d6424f;
  font: 600 11px/1.2 var(--font-mono);
  letter-spacing: .18em;
}

.context-copy > p:last-child {
  margin: 0;
  font-size: clamp(24px, 3vw, 42px);
  font-weight: 450;
  line-height: 1.18;
  letter-spacing: -.035em;
}

.context-rule {
  width: 56px;
  height: 1px;
  margin-top: auto;
  background: var(--crimson);
  box-shadow: 72px 0 0 rgba(245, 241, 232, .32);
}

.auth-main {
  min-width: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(28px, 6vw, 86px);
}

.auth-panel {
  width: min(100%, var(--panel-width));
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper-raised);
}

.auth-view {
  min-width: 0;
  padding: clamp(36px, 4vw, 52px) var(--panel-gutter) clamp(36px, 4vw, 48px);
  animation: view-in 220ms cubic-bezier(.22, 1, .36, 1) both;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--crimson);
  font: 600 11px/1.2 var(--font-mono);
  letter-spacing: .15em;
  text-transform: uppercase;
}

h1 {
  max-width: 520px;
  margin: 0;
  font-size: clamp(34px, 3.6vw, 52px);
  font-weight: 520;
  line-height: 1.14;
  letter-spacing: -.045em;
  text-wrap: balance;
}

.lede {
  max-width: 510px;
  margin: 20px 0 0;
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 1.75;
}

.status-block {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 13px;
  margin-top: 28px;
  padding: 17px 18px;
  border-radius: 2px;
  background: var(--paper);
}

.status-block.quiet {
  margin-bottom: 34px;
}

.status-mark {
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--crimson);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--crimson) 12%, transparent);
}

.status-block[data-tone="success"] .status-mark {
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 14%, transparent);
}

.status-block[data-tone="error"] .status-mark {
  background: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 14%, transparent);
}

.status-block strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.55;
}

.status-block p {
  margin: 5px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.55;
}

.primary-action {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 28px;
  padding: 14px 18px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  font-weight: 620;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease, transform 100ms ease;
}

.primary-action:hover {
  background: var(--crimson-dark);
  border-color: var(--crimson-dark);
}

.primary-action:active {
  transform: translateY(1px);
}

.primary-action:disabled {
  cursor: wait;
  opacity: .56;
}

.anchor-action {
  box-sizing: border-box;
}

.secondary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px 28px;
  margin-top: 30px;
}

.secondary-actions a,
.link-button,
.text-action {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 13px;
  text-decoration-color: color-mix(in srgb, var(--ink-muted) 40%, transparent);
  text-underline-offset: 4px;
}

.secondary-actions a:hover,
.link-button:hover,
.text-action:hover {
  color: var(--crimson);
}

.compatibility-toggle {
  display: flex;
  align-items: center;
  min-height: 36px;
  margin: 10px 0 0 auto;
  line-height: 1.6;
  text-align: right;
  text-decoration: underline;
}

.passkey-lookup {
  gap: 15px;
  margin-top: 22px;
  padding: 24px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.compatibility-note {
  margin: 0 0 2px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.75;
}

.lookup-action {
  width: 100%;
  min-height: 47px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 15px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 620;
  transition: background-color 140ms ease, color 140ms ease, transform 100ms ease;
}

.lookup-action:hover {
  background: var(--ink);
  color: var(--paper);
}

.lookup-action:active {
  transform: translateY(1px);
}

.lookup-action:disabled {
  cursor: wait;
  opacity: .56;
}

.auth-form {
  min-width: 0;
  display: grid;
  gap: 21px;
  margin-top: 34px;
}

.auth-form label,
.captcha-field {
  display: grid;
  gap: 9px;
}

.auth-form label > span,
.captcha-heading > span {
  font: 570 12px/1.2 var(--font-mono);
  letter-spacing: .04em;
}

.auth-form small {
  color: var(--ink-muted);
  font-size: 11px;
  line-height: 1.45;
}

.auth-form input {
  min-width: 0;
  width: 100%;
  min-height: 47px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  outline: none;
  background: transparent;
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.auth-form input:focus {
  border-color: var(--ink);
  box-shadow: inset 3px 0 0 var(--crimson);
}

.captcha-field {
  grid-template-columns: 200px minmax(0, 1fr);
  align-items: end;
  padding-top: 4px;
}

.captcha-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.captcha-image-button {
  width: 200px;
  height: 80px;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
}

.captcha-image-button img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.form-error {
  margin: -3px 0 0;
  padding: 12px 13px;
  border-left: 3px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, transparent);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.55;
}

.account-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 38px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.account-facts > div {
  min-width: 0;
  padding: 18px 0;
}

.account-facts > div + div {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.account-facts span,
.account-facts strong {
  display: block;
}

.account-facts span {
  color: var(--ink-muted);
  font: 500 10px/1.2 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.account-facts strong {
  margin-top: 8px;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-footer {
  width: min(100%, var(--panel-width));
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 28px auto 0;
  padding-inline: var(--panel-gutter);
  color: var(--ink-muted);
  font: 500 9px/1.2 var(--font-mono);
  letter-spacing: .14em;
}

noscript {
  position: fixed;
  inset: auto 16px 16px;
  padding: 12px;
  background: var(--danger);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 3px;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  :root {
    --panel-gutter: clamp(20px, 5vw, 36px);
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-context {
    min-height: auto;
    padding: 24px 22px 28px;
    border-right: 0;
    border-bottom: 1px solid #0f0f0e;
  }

  .auth-context::after,
  .context-index,
  .context-copy > p:last-child,
  .context-rule {
    display: none;
  }

  .brand-link img {
    width: 178px;
  }

  .context-copy {
    margin-top: 21px;
  }

  .context-kicker {
    margin: 0;
    font-size: 9px;
  }

  .auth-main {
    padding: 30px 18px max(30px, env(safe-area-inset-bottom));
  }

  .auth-view {
    padding: 32px var(--panel-gutter) 34px;
  }

  h1 {
    font-size: clamp(32px, 6vw, 44px);
  }
}

@media (max-width: 520px) {
  .status-block {
    gap: 10px;
    padding: 15px 13px;
  }

  .auth-form input {
    font-size: 16px;
  }

  .auth-footer {
    padding-inline: 0;
  }

  .captcha-field {
    grid-template-columns: 1fr;
  }

  .captcha-heading {
    grid-column: 1;
  }

  .captcha-image-button {
    width: 100%;
    max-width: 240px;
  }

  .account-facts {
    grid-template-columns: 1fr;
  }

  .account-facts > div + div {
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 360px) {
  .auth-main {
    padding-inline: 12px;
  }

  .auth-view {
    padding-block: 28px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151513;
    --paper-raised: #1a1a18;
    --ink: #f5f1e8;
    --ink-muted: #aaa398;
    --line: #3c3934;
    --line-strong: #69635b;
    --crimson: #d6424f;
    --crimson-dark: #b0232f;
    --graphite: #0f0f0e;
    --graphite-muted: #8f8980;
  }

  body {
    background:
      linear-gradient(90deg, transparent calc(100% - 1px), rgba(245, 241, 232, .035) calc(100% - 1px)) 0 0 / 48px 48px,
      linear-gradient(transparent calc(100% - 1px), rgba(245, 241, 232, .025) calc(100% - 1px)) 0 0 / 48px 48px,
      var(--paper);
  }

  .captcha-image-button {
    background: #f5f1e8;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
