:root {
  color-scheme: light;
  background: #f6f0e9;
  color: #2a2527;
  font: 16px/1.5 system-ui, sans-serif;
  --accent: #ad2825;
  --accent-hover: #8d2421;
  --text-muted: #645550;
  --border: #dfcbc0;
  --line: #eadcd2;
  --error: #8d2320;
}

* { box-sizing: border-box; }

body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: safe center;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: clamp(1rem, 5vw, 3rem) clamp(.75rem, 4vw, 2rem);
}

main {
  width: 100%;
  max-width: 35rem;
  min-width: 0;
  margin-inline: auto;
  padding: clamp(1.25rem, 5vw, 2.5rem);
  border: 1px solid var(--border);
  border-radius: clamp(1rem, 4vw, 1.5rem);
  background: #fffcf8;
  box-shadow: 0 16px 40px rgb(52 27 20 / 6%);
}

.heading { display: grid; gap: clamp(1.4rem, 4vw, 2rem); }

.brand {
  display: block;
  width: min(100%, 11rem);
  height: auto;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 2.625rem);
  line-height: 1.09;
  letter-spacing: -.035em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.intro {
  margin: .65rem 0 1.5rem;
  color: var(--text-muted);
  max-inline-size: 46ch;
}

.intro + .intro { margin-top: -.6rem; }

form { display: grid; gap: 1.05rem; }

.names {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.05rem;
}

@media (min-width: 30rem) {
  .names { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: .3rem;
}

label { font-size: .9rem; font-weight: 650; }

input:not([type="hidden"]):not([type="checkbox"]) {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: .6rem .8rem;
  border: 1px solid #aa9388;
  border-radius: .55rem;
  color: inherit;
  background: #fff;
  font: inherit;
}

.password-control { position: relative; }

.password-control:has(button:not([hidden])) > input { padding-inline-end: 6.4rem; }

[data-password-toggle] {
  position: absolute;
  inset-block: .2rem;
  inset-inline-end: .3rem;
  padding: 0 .45rem;
  border: 0;
  border-radius: .3rem;
  color: #783531;
  background: #fff;
  font: 650 .85rem/1.2 system-ui, sans-serif;
  cursor: pointer;
}

[data-password-toggle]:hover { background: #f7e9e2; }

.field-hint, .field-error {
  margin: 0;
  font-size: .85rem;
  overflow-wrap: anywhere;
}

.field-hint { color: var(--text-muted); }
.field-error { color: var(--error); font-weight: 600; }
input[aria-invalid="true"]:not([type="hidden"]) { border-color: var(--error); }

.notice {
  margin: 0 0 1.15rem;
  padding: .65rem .8rem;
  border: 1px solid #e6ccbb;
  border-radius: .55rem;
  background: #f8ece1;
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.notice.error {
  border-color: #efc3ba;
  color: var(--error);
  background: #fbeae5;
}

.button {
  display: inline-grid;
  min-height: 3rem;
  margin: .1rem 0 0;
  padding: .65rem 1rem;
  place-items: center;
  border: 1px solid transparent;
  border-radius: .55rem;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { background: var(--accent-hover); }

.button-outline {
  border-color: var(--border);
  color: var(--accent-hover);
  background: transparent;
}

.button-outline:hover { background: #f8ece1; }
.button[hidden] { display: none; }
.button[aria-disabled="true"] { cursor: progress; }

.passkey:not([hidden]) { display: grid; gap: .65rem; }

.passkey[data-passkey="login"] {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.passkey-opt-in:not([hidden]) {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  min-height: 1.5rem;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
}

.passkey-opt-in input {
  flex: none;
  width: 1rem;
  height: 1rem;
  margin: .15rem 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.passkey-status {
  margin: 0;
  color: var(--text-muted);
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.passkey-status:empty { position: absolute; }
.passkey-status.error { color: var(--error); }

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0 1rem;
  margin-top: 1.15rem;
  padding-top: .55rem;
  border-top: 1px solid var(--line);
  font-size: .875rem;
}

.actions a, .secondary {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding-block: .3rem;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: .2em;
}

.actions a { color: var(--accent-hover); font-weight: 650; }
.actions form { margin-inline-start: auto; }

.secondary {
  padding-inline: 0;
  border: 0;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
}

.secondary:hover { color: var(--accent-hover); }
.actions > form:only-child { margin-inline-start: 0; }

:focus-visible {
  outline: 2px solid #91332e;
  outline-offset: 3px;
}
