/* ACCOUNT DIALOG
   Sign in and Create account (partials/account-dialog.hbs, assets/js/mews-account.js). Styled like
   Portal's popup, because Portal takes over after a sign-in with its "enter the code" screen: white
   in both colour schemes, rounded, centred, in Inter. Literal colours for the same reason. */

html.account-dialog-open {
  overflow: hidden;
}

.account-dialog {
  background-color: #fff;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.25);
  color: #15171a;
  color-scheme: light;
  font-family: var(--font-accent);
  max-height: calc(100dvh - 2rem);
  max-width: min(31.25rem, calc(100vw - 2rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  width: 100%;
}

/* Literal colours: older Safari does not pass custom properties into ::backdrop */
.account-dialog::backdrop {
  background-color: rgba(26, 24, 23, 0.55);
}

html.theme-dark .account-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.7);
}

.account-dialog-inner {
  padding: 2rem;
  position: relative;
  text-align: center;
}

.account-dialog-close {
  align-items: center;
  background: none;
  border: 0;
  color: #15171a;
  cursor: pointer;
  display: inline-flex;
  height: 2.75rem;
  justify-content: center;
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  width: 2.75rem;
}

.account-dialog-close svg {
  height: 1.25rem;
  width: 1.25rem;
}

/* The site icon, as Portal shows it */
.account-dialog-logo {
  border-radius: 2px;
  display: block;
  height: 3.75rem;
  margin: 0.75rem auto 0.625rem;
  object-fit: cover;
  width: 3.75rem;
}

.account-title {
  color: #15171a;
  font-family: var(--font-accent);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 2rem 0.75rem;
}

.account-title:focus {
  outline: none;
}

.account-intro {
  color: #555;
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0 auto 1.75rem;
  max-width: 24rem;
}

.account-email {
  color: #15171a;
  font-weight: 600;
  overflow-wrap: anywhere;
}


/* Forms */

.account-form {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.account-label {
  color: #15171a;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.account-input {
  background-color: #fff;
  border: 1px solid #d1d1d1;
  border-radius: 6px;
  color: #15171a;
  font-family: inherit;
  font-size: max(1rem, 16px);
  height: 2.75rem;
  margin-bottom: 1rem;
  padding: 0 0.875rem;
  transition: border-color 0.15s ease-out;
  width: 100%;
}

.account-input::placeholder {
  color: #737373;
  opacity: 1;
}

.account-input:hover {
  border-color: #a3a3a3;
}

.account-input:focus-visible {
  border-color: #15171a;
  outline: 2px solid #15171a;
  outline-offset: 1px;
}

/* Settings > Portal > Signup terms */
.account-terms {
  color: #555;
  font-size: 0.8125rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.account-terms--check {
  align-items: flex-start;
  display: flex;
  gap: 0.5rem;
}

.account-terms--check input {
  flex-shrink: 0;
  margin-top: 0.2em;
}

.account-terms p {
  margin: 0;
}

.account-terms a {
  color: inherit;
  text-decoration: underline;
}

/* Colours come from the site accent (inline style), as on every other button */
.account-submit {
  align-items: center;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  height: 2.75rem;
  justify-content: center;
  margin-top: 0.5rem;
  transition: opacity 0.15s ease-out;
  width: 100%;
}

.account-submit:hover {
  opacity: 0.88;
}

.account-submit:focus-visible {
  outline: 2px solid #15171a;
  outline-offset: 2px;
}

.account-submit[aria-disabled="true"] {
  cursor: progress;
  opacity: 0.7;
}

/* Filled in by Portal. Stays in the accessibility tree while empty, so the first error is announced. */
.account-error {
  color: #c5221f;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0.75rem 0 0;
  text-align: center;
}

.account-error:empty {
  clip-path: inset(50%);
  height: 1px;
  margin: 0;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.account-switch {
  color: #555;
  font-size: 0.9375rem;
  margin: 1.5rem 0 0;
}

.account-switch button {
  background: none;
  border: 0;
  color: #15171a;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  padding: 0.25rem;
}

.account-switch button:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.account-dialog-close:focus-visible,
.account-switch button:focus-visible {
  outline: 2px solid #15171a;
  outline-offset: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .account-dialog[open] {
    animation: account-dialog-in 0.2s ease-out;
  }

  @keyframes account-dialog-in {
    from {
      opacity: 0;
      transform: translateY(0.75rem);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-input,
  .account-submit {
    transition: none;
  }
}

/* 480px */
@media (max-width: 479.98px) {
  .account-dialog {margin-bottom: auto; margin-top: 1rem;}
  .account-dialog-inner {padding: 1.75rem 1.25rem 1.5rem;}
  .account-title {font-size: 1.75rem;}
}
