/* Viewer sign-in in the site header and the /account page. */
.ds-account {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.ds-account__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  max-width: 220px;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.ds-account__trigger:hover,
.ds-account__trigger[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.ds-account__trigger:focus-visible,
.ds-account__menu-item:focus-visible {
  outline: 2px solid #4f9fd6;
  outline-offset: 2px;
}

.ds-account__avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  margin-left: -6px;
  border-radius: 50%;
  object-fit: cover;
}

.ds-account__initial {
  display: inline-grid;
  place-items: center;
  background: #2fb6a3;
  color: #071311;
  font-weight: 700;
  font-size: 13px;
}

.ds-account__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-account__menu {
  position: fixed;
  z-index: 60;
  display: flex;
  min-width: 200px;
  flex-direction: column;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #11161b;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.ds-account__menu[hidden] {
  display: none;
}

.ds-account__menu-item {
  display: block;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #e8edf2;
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ds-account__menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.ds-account-toast {
  position: fixed;
  z-index: 90;
  right: 16px;
  bottom: 16px;
  left: 16px;
  max-width: 380px;
  margin-left: auto;
  padding: 12px 16px;
  border: 1px solid rgba(224, 105, 114, 0.5);
  border-radius: 8px;
  background: #1b1214;
  color: #f2d6d9;
  font-size: 14px;
}

@media (max-width: 640px) {
  .ds-account__name {
    display: none;
  }

  .ds-account__trigger:has(.ds-account__avatar) {
    padding: 4px;
  }

  .ds-account__trigger:has(.ds-account__avatar) .ds-account__avatar {
    margin-left: 0;
  }
}

/* ---- /account page ------------------------------------------------------------------- */
.account-page main {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 80px;
}

.account-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.account-card h1,
.account-card h2 {
  margin: 0;
}

.account-card h2 {
  font-size: 18px;
}

.account-card p {
  margin: 0;
  color: #a9b6bf;
  line-height: 1.5;
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.account-profile .ds-account__avatar {
  flex-basis: 64px;
  width: 64px;
  height: 64px;
  margin: 0;
  font-size: 26px;
}

.account-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.account-row small {
  display: block;
  color: #8d9aa4;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.account-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #e8edf2;
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.account-button--primary {
  border-color: transparent;
  background: #2fb6a3;
  color: #061210;
  font-weight: 700;
}

.account-button--danger {
  border-color: rgba(224, 105, 114, 0.5);
  color: #f2a7ae;
}

.account-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.account-form input {
  flex: 1 1 220px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #0d1216;
  color: #e8edf2;
  font: inherit;
}

.account-message[data-kind="error"] { color: #f2a7ae; }
.account-message[data-kind="success"] { color: #6fdcb6; }

/* The site's hero headings are display-sized; a nickname must fit any phone. */
.account-page .account-card h1 {
  font-size: clamp(22px, 6vw, 32px);
  line-height: 1.15;
  text-transform: none;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.account-page .account-profile > div {
  min-width: 0;
}
