@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/assets/atkinson-hyperlegible-next/AtkinsonHyperlegibleNext-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/assets/atkinson-hyperlegible-next/AtkinsonHyperlegibleNext-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --gold: #f8b94c;
  --black: #151514;
  --white: #ffffff;
  --paper: #fffaf0;
  --line: #d8c9a8;
  --muted: #5d5a54;
  --ink-soft: #2b2a28;
  --soft: #f4efe3;
  --danger: #7b1b1b;
  --danger-bg: #fff0ef;
  --focus: #7c570d;
}

body[data-theme="willing"] {
  --gold: #d7a928;
  --black: #073364;
  --white: #ffffff;
  --paper: #073364;
  --line: #b8cbe0;
  --muted: #38536f;
  --ink-soft: #dceafa;
  --soft: #eef5fb;
  --danger: #7b1b1b;
  --danger-bg: #fff0ef;
  --focus: #d7a928;
  min-height: 100vh;
  background: var(--paper);
  color: var(--white);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  color: var(--black);
  font-family: "Atkinson Hyperlegible Next", sans-serif;
}

body {
  margin: 0;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

.identity-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5rem;
  padding: .85rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.identity-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: min(36rem, calc(100vw - 14rem));
  color: var(--black);
  text-decoration: none;
}

.identity-brand img {
  width: clamp(15rem, 30vw, 24rem);
  max-width: 100%;
  max-height: 5.8rem;
  height: auto;
  object-fit: contain;
}

.identity-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .3rem .2rem;
  border-bottom: .25rem solid transparent;
  font-weight: 700;
  text-decoration: none;
}

.nav-link:hover,
.nav-link.is-active {
  border-bottom-color: var(--gold);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: .72rem 1.05rem;
  border: 2px solid var(--black);
  background: var(--gold);
  color: var(--black);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 .18rem 0 var(--black);
  cursor: pointer;
}

.button:hover,
.button:focus-visible {
  background: var(--black);
  color: var(--white);
}

.button:disabled {
  cursor: progress;
  opacity: .7;
}

.button-small {
  min-height: 2.35rem;
  padding: .5rem .8rem;
}

.button-plain {
  background: var(--white);
  box-shadow: none;
}

.identity-shell {
  width: min(100%, 118rem);
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 3.25rem);
}

.login-view,
.invite-view {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(24rem, .85fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  align-items: center;
  min-height: calc(100vh - 8rem);
}

.invite-view-single {
  grid-template-columns: minmax(0, 42rem);
  justify-content: center;
  align-items: start;
  min-height: auto;
  padding-block: clamp(1rem, 4vw, 3rem);
}

.invite-view-single .login-card {
  justify-self: stretch;
  width: 100%;
}

.login-continuation {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(21, 21, 20, .78);
}

.continuation-card {
  display: grid;
  justify-items: center;
  gap: 1rem;
  width: min(100%, 30rem);
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-top: .5rem solid var(--gold);
  background: var(--white);
  color: var(--black);
  text-align: center;
  box-shadow: 0 .75rem 0 rgba(0, 0, 0, .2);
}

.continuation-card h1 {
  margin: .15rem 0 0;
  font-size: clamp(2.2rem, 8vw, 4rem);
  line-height: 1;
}

.continuation-card p:not(.eyebrow):not(.form-error) {
  margin: .6rem 0 0;
  color: var(--muted);
  font-weight: 700;
}

.spinner {
  width: 3.4rem;
  height: 3.4rem;
  border: .38rem solid var(--line);
  border-top-color: var(--gold);
  border-right-color: var(--black);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.login-copy {
  display: grid;
  gap: 1rem;
  max-width: 46rem;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-copy h1,
.section-heading h1 {
  margin: 0;
  color: var(--black);
  font-size: clamp(2.8rem, 7vw, 5.8rem);
  line-height: .98;
}

.login-copy p:not(.eyebrow) {
  margin: 0;
  max-width: 38rem;
  color: var(--ink-soft);
  font-size: clamp(1.12rem, 2vw, 1.45rem);
  line-height: 1.45;
}

.login-card,
.profile-form,
.identity-panel {
  border: 1px solid var(--line);
  background: var(--white);
}

.login-card {
  display: grid;
  gap: 1rem;
  width: min(100%, 33rem);
  justify-self: end;
  padding: clamp(1.1rem, 3vw, 1.65rem);
  border-top: .5rem solid var(--gold);
  box-shadow: 0 .5rem 0 rgba(21, 21, 20, .08);
}

.card-banner {
  display: flex;
  align-items: center;
  min-height: 5.2rem;
  padding: .55rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.card-banner img {
  width: 100%;
  max-height: 4.8rem;
  object-fit: contain;
  object-position: left center;
}

.seal-mark {
  display: grid;
  place-items: center;
  width: 5.4rem;
  height: 5.4rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.seal-mark img {
  width: 4.45rem;
  height: 4.45rem;
  object-fit: contain;
}

.login-card h2,
.login-card h3,
.section-heading h2 {
  margin: .15rem 0 0;
  font-size: clamp(1.8rem, 4vw, 2.45rem);
  line-height: 1.05;
}

.invite-fields,
.invite-totp-panel {
  display: grid;
  gap: 1rem;
}

.password-policy {
  display: grid;
  gap: .45rem;
  padding: .75rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.password-policy ul {
  display: grid;
  gap: .35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.password-policy li {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-weight: 700;
}

.password-policy li::before {
  content: "";
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line);
  background: var(--white);
}

.password-policy li.is-met::before {
  content: "\2713";
  border-color: var(--gold);
  background: var(--gold);
  color: var(--black);
  font-size: .8rem;
  font-weight: 900;
}

body[data-theme="willing"] .button {
  border-color: #151514;
  background: var(--black);
  color: var(--white);
  box-shadow: 0 .18rem 0 #151514;
}

body[data-theme="willing"] .button:hover,
body[data-theme="willing"] .button:focus-visible {
  border-color: #151514;
  background: #0b477f;
  color: var(--white);
}

body[data-theme="willing"] .button-plain {
  border-color: var(--line);
  background: var(--white);
  color: var(--black);
  box-shadow: none;
}

body[data-theme="willing"] .login-card,
body[data-theme="willing"] .continuation-card {
  border-top-color: var(--gold);
}

body[data-theme="willing"] .spinner {
  border-top-color: var(--black);
  border-right-color: var(--gold);
}

body[data-theme="willing"] .password-policy li.is-met::before {
  border-color: var(--black);
  background: var(--black);
  color: var(--white);
}

body[data-theme="willing"] .identity-top {
  border-bottom-color: var(--line);
  background: var(--white);
}

body[data-theme="willing"] .login-copy h1,
body[data-theme="willing"] .section-heading h1 {
  color: var(--white);
}

body[data-theme="willing"] .login-copy p:not(.eyebrow) {
  color: var(--ink-soft);
}

body[data-theme="willing"] .login-card,
body[data-theme="willing"] .profile-form,
body[data-theme="willing"] .identity-panel,
body[data-theme="willing"] .security-card,
body[data-theme="willing"] .continuation-card {
  color: var(--black);
}

body[data-theme="willing"] .password-policy,
body[data-theme="willing"] .card-banner,
body[data-theme="willing"] .seal-mark,
body[data-theme="willing"] .totp-qr-card,
body[data-theme="willing"] .totp-secret-box,
body[data-theme="willing"] .warning-box {
  background: var(--soft);
}

.invite-totp-panel {
  padding-top: .25rem;
}

.field,
.check-field {
  display: grid;
  gap: .35rem;
  font-weight: 700;
}

.field-label,
.field span,
.check-field {
  color: var(--muted);
  font-size: .92rem;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 2.8rem;
  padding: .68rem .75rem;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--black);
}

.field textarea {
  resize: vertical;
  line-height: 1.45;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.button:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.form-error {
  margin: 0;
  padding: .78rem .85rem;
  border: 1px solid #d8a1a1;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
  line-height: 1.35;
}

.form-success {
  margin: 0;
  padding: .78rem .85rem;
  border: 1px solid #9fc18a;
  background: #f1faec;
  color: #244319;
  font-weight: 700;
  line-height: 1.35;
}

.form-success a,
.text-link {
  color: var(--black);
  font-weight: 700;
  text-decoration-thickness: .12rem;
  text-underline-offset: .2rem;
}

.warning-box {
  margin: 0;
  padding: .9rem 1rem;
  border: 2px solid var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
  line-height: 1.4;
}

.profile-view,
.security-view {
  display: grid;
  gap: 1.1rem;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading-small {
  align-items: center;
}

.section-heading h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
}

.profile-form {
  display: grid;
  gap: 1rem;
  max-width: 78rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border-top: .5rem solid var(--gold);
}

.identity-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 1rem;
  background: var(--paper);
}

.identity-panel div {
  display: grid;
  gap: .25rem;
  min-width: 0;
}

.identity-panel strong {
  overflow-wrap: anywhere;
}

.profile-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.contacts-editor {
  display: grid;
  gap: .75rem;
  padding-top: .5rem;
}

.contact-list {
  display: grid;
  gap: .75rem;
}

.contact-row {
  display: grid;
  grid-template-columns: minmax(8rem, .75fr) minmax(10rem, 1fr) minmax(14rem, 1.6fr) auto auto;
  gap: .75rem;
  align-items: end;
  padding: .9rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.field-compact {
  min-width: 0;
}

.check-field {
  display: inline-flex;
  align-items: center;
  min-height: 2.8rem;
  gap: .4rem;
  white-space: nowrap;
}

.check-field input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--gold);
}

.check-field-wrap {
  align-items: flex-start;
  line-height: 1.35;
  white-space: normal;
}

.check-field-wrap input {
  flex: 0 0 auto;
  margin-top: .15rem;
}

.empty-state {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--line);
  background: var(--paper);
  color: var(--muted);
  font-weight: 700;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.save-status {
  color: var(--muted);
  font-weight: 700;
}

.security-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.security-card {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-top: .5rem solid var(--gold);
  background: var(--white);
}

.security-card h2 {
  margin: .15rem 0 0;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  line-height: 1.05;
}

.security-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: .28rem .65rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--black);
  font-size: .85rem;
  white-space: nowrap;
}

.security-copy {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.totp-action,
.totp-registration {
  display: grid;
  gap: 1rem;
}

.totp-setup-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.totp-qr-card,
.totp-secret-box {
  display: grid;
  gap: .35rem;
  min-width: 0;
  padding: .85rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.totp-qr-card {
  margin: 0;
  place-items: center;
  align-content: center;
  text-align: center;
}

.totp-qr-card img {
  width: min(100%, 15rem);
  height: auto;
  image-rendering: pixelated;
  border: .5rem solid var(--white);
  background: var(--white);
}

.totp-qr-card figcaption {
  color: var(--muted);
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.35;
}

.totp-secret-box code {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  overflow-wrap: normal;
  color: var(--black);
  font-family: "Atkinson Hyperlegible Next", sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
}

.totp-manual-list {
  display: grid;
  gap: .45rem;
  margin: 0;
}

.totp-manual-list div {
  display: grid;
  grid-template-columns: 1fr;
  gap: .15rem;
  align-items: start;
  padding-block: .25rem;
  border-bottom: 1px solid rgba(21, 21, 20, .12);
}

.totp-manual-list div:last-child {
  border-bottom: 0;
}

.totp-manual-list dt {
  color: var(--muted);
  font-weight: 800;
}

.totp-manual-list dd {
  min-width: 0;
  margin: 0;
  color: var(--black);
  overflow-wrap: break-word;
  font-weight: 700;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .login-view,
  .invite-view {
    grid-template-columns: 1fr;
    align-items: start;
    min-height: auto;
  }

  .login-card {
    justify-self: start;
  }

  .contact-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .totp-setup-grid {
    grid-template-columns: 1fr;
  }

  .totp-qr-card img {
    width: min(100%, 13rem);
  }
}

@media (max-width: 700px) {
  .identity-top,
  .section-heading,
  .identity-panel,
  .profile-fields-grid,
  .security-grid,
  .security-card-heading,
  .totp-setup-grid,
  .contact-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .identity-actions {
    justify-content: flex-start;
  }

  .identity-brand {
    max-width: 100%;
  }

  .login-copy h1 {
    font-size: clamp(2.4rem, 13vw, 3.9rem);
  }

  .login-card,
  .invite-card,
  .profile-form {
    width: 100%;
  }
}
