/* The pages of the authentication host (login, account): the look of the website's former sign-in page, the SSMT
   palette and fonts, without a build step */

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('fonts/playfair-display-variable.woff2') format('woff2');
}

@font-face {
  font-family: 'Tinos';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/tinos-regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Tinos';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/tinos-bold.woff2') format('woff2');
}

:root {
  --teal: #00444f;
  --teal-deep: #013a44;
  --cream: #f8f6f0;
  --cream-sunken: #f6f1e7;
  --field: #fffbf0;
  --border: #e7e0d0;
  --border-hover: #9f9788;
  --border-strong: #827c72;
  --gold-readable: #6d6c13;
  --black: #010103;
  --muted: #5c6b6e;
  --on-dark: #fffbf0;
  --on-dark-muted: #a9bbb9;
  --danger: #b91c1c;
  --success: #166534;
  --radius-field: 0.875rem;
  --radius-card: 1.5rem;
  --font-body: 'Tinos', Georgia, 'Times New Roman', serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The passkeys' parts stay hidden until public/idp/passkeys.js finds the browser can use them, even on a flex box */
[hidden] {
  display: none !important;
}

html {
  background: var(--teal);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  padding: 2.5rem 1rem;
  background: var(--teal);
  color: var(--teal);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--teal);
  text-underline-offset: 0.25em;
}

/* The website's ring: a cream line in a deep teal halo, visible on the teal page and on the cream cards */
:focus-visible {
  outline: 2px solid var(--on-dark);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--teal-deep);
}

[tabindex='-1']:focus {
  outline: none;
  box-shadow: none;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--cream);
  color: var(--teal);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* The page: one cream card centered on the teal, the account's sections stacked under its first one */
.shell {
  width: 100%;
  max-width: 28.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.shell.wide {
  max-width: 40rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 2.5rem 1.5rem;
  border-radius: var(--radius-card);
  background: var(--cream);
}

.card-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.logo {
  display: block;
  border-radius: 0.5rem;
}

.logo img {
  display: block;
  width: 13.125rem;
  max-width: 100%;
  height: auto;
}

.intro {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--black);
  overflow-wrap: break-word;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.375rem;
}

.lead,
.section-lead {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.alert {
  padding: 0.75rem 1rem;
  border: 1px solid;
  border-radius: var(--radius-field);
  font-size: 0.9375rem;
}

.alert ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.alert-error {
  border-color: #f2c4bf;
  background: #fdf1f0;
  color: var(--danger);
}

.alert-success {
  border-color: #bfdcc8;
  background: #f0f8f2;
  color: var(--success);
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field label {
  font-size: 0.875rem;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--teal);
}

.hint,
.error {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.hint {
  color: var(--muted);
}

.error {
  color: var(--danger);
}

input:is([type='email'], [type='password'], [type='text'], [type='tel'], [type='file']),
select {
  width: 100%;
  min-height: 3.25rem;
  margin: 0;
  padding: 0 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  background: var(--field);
  color: var(--teal);
  font: inherit;
  font-size: 1rem;
}

input::placeholder {
  color: var(--muted);
  opacity: 1;
}

input:hover,
select:hover {
  border-color: var(--border-hover);
}

input:focus-visible,
select:focus-visible {
  border-color: var(--teal);
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  box-shadow: none;
}

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

input[readonly] {
  background: var(--cream-sunken);
  cursor: default;
}

input:-webkit-autofill,
input:-webkit-autofill:focus {
  box-shadow: 0 0 0 100px var(--field) inset;
  -webkit-text-fill-color: var(--teal);
}

input.input-code {
  font-size: 1.125rem;
  letter-spacing: 0.5em;
  text-align: center;
}

input[type='file'] {
  padding: 0.5rem;
  font-size: 0.9375rem;
  cursor: pointer;
}

input[type='file']::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--teal);
  border-radius: 999px;
  background: transparent;
  color: var(--teal);
  font: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.075rem;
  text-transform: uppercase;
  cursor: pointer;
}

input[type='file']::file-selector-button:hover {
  background: var(--cream-sunken);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 0.75rem;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  font-size: 0.8125rem;
  color: var(--teal);
  cursor: pointer;
}

.check input {
  appearance: none;
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  background: var(--field) center / 0.75rem no-repeat;
  cursor: pointer;
}

.check input:checked {
  border-color: var(--teal);
  background-color: var(--teal);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='%23fffbf0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7.5 5.75 10 11 4'/%3E%3C/svg%3E");
}

@media (forced-colors: active) {
  .check input {
    appearance: auto;
  }
}

.link-gold {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: 0.8125rem;
  color: var(--gold-readable);
  text-decoration: none;
}

.link-gold:hover {
  text-decoration: underline;
}

/* Buttons: the website's pills, uppercase and spaced */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.625rem 1.75rem;
  border: 1.5px solid var(--teal);
  border-radius: 999px;
  background: var(--teal);
  color: var(--on-dark);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.0875rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.button:hover {
  border-color: var(--teal-deep);
  background: var(--teal-deep);
  color: var(--on-dark);
}

.button-block {
  width: 100%;
}

.button-secondary {
  background: transparent;
  color: var(--teal);
}

.button-secondary:hover {
  background: var(--cream-sunken);
  color: var(--teal-deep);
}

.button-danger {
  border-color: var(--danger);
  background: transparent;
  color: var(--danger);
}

.button-danger:hover {
  border-color: var(--danger);
  background: #fdf1f0;
  color: var(--danger);
}

.button-small {
  min-height: 2.5rem;
  padding-inline: 1.25rem;
  font-size: 0.8125rem;
}

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

.icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

/* The ways to sign in without the address: a passkey, Google */
.alternatives {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.alternatives .form {
  gap: 0.5rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.075rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

.form .button:not(.button-block) {
  align-self: flex-start;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 1.5rem;
  font-size: 0.8125rem;
}

.links a,
.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--teal);
  text-decoration: none;
}

.links a:hover,
.link-button:hover {
  text-decoration: underline;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.inline-form {
  display: inline;
  margin: 0;
}

.signout {
  display: flex;
  justify-content: center;
  margin: 0;
}

/* The account's sections */
.profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-name {
  display: block;
  font-weight: 700;
}

.profile-email {
  display: block;
  font-size: 0.9375rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.avatar {
  flex: none;
  width: 4rem;
  height: 4rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--cream-sunken);
  object-fit: cover;
}

.empty {
  margin: 0;
  color: var(--muted);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.list li > div {
  flex: 1 1 16rem;
  min-width: 0;
}

.list strong {
  display: block;
}

.meta {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.revoke-all {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* Securing the account: the choice between a passkey and the authenticator app */
.choices {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  background: var(--field);
  text-decoration: none;
}

.choice:hover {
  border-color: var(--teal);
  background: var(--cream-sunken);
}

.choice .icon {
  margin-top: 0.125rem;
}

.choice strong {
  display: block;
  color: var(--black);
}

/* The account's passkeys: each with its rename and delete forms, folded */
.sublist {
  flex: 1 1 100%;
}

.sublist li {
  padding: 0.75rem 0;
}

.sublist li:first-child {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.disclosure {
  flex: 1 1 100%;
}

.disclosure summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: 0.8125rem;
  color: var(--teal);
  cursor: pointer;
}

.disclosure summary:hover {
  text-decoration: underline;
}

.disclosure[open] summary {
  margin-bottom: 0.5rem;
}

/* The second factor: the authenticator app's setup and the recovery codes */
.setup {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
}

.steps li > * {
  margin-top: 0.75rem;
}

.qr {
  display: block;
  width: 12.5rem;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  overflow: hidden;
  background: #fff;
}

.qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.secret {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-field);
  background: var(--cream-sunken);
  color: var(--teal);
  font-size: 0.9375rem;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
}

.codes {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  background: var(--field);
}

.codes-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.codes-list code,
.secret {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

.codes-list code {
  font-size: 1rem;
  color: var(--teal);
}

.list li > .form,
.list li > .hint {
  flex: 1 1 100%;
}

/* Under the card: the address and the language, light on the teal */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 1rem;
  font-size: 0.8125rem;
  color: var(--on-dark-muted);
  text-align: center;
}

.footer p {
  margin: 0;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  color: var(--on-dark);
  text-decoration: underline;
}

.locale {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.locale a,
.locale-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  min-height: 1.5rem;
}

.locale-current {
  font-weight: 700;
  color: var(--on-dark);
}

@media (min-width: 40rem) {
  .card {
    padding: 3rem 2.75rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  a,
  input,
  .button,
  .link-button {
    transition:
      background-color 0.15s ease,
      border-color 0.15s ease,
      color 0.15s ease;
  }

  .skip-link {
    transition: transform 0.15s ease;
  }
}
