/* The account surfaces: the account page, and the two pieces the plans page
   shares with it (the paid plan's edge, the notice). The plan card itself is
   account-plan.css. Signed in, the page reads like a settings window: a
   section title, a caption, then the rows as one inset grouped list. */

/* A paid plan's card: lifted by a hairline of the tint (account.js adds the
   class), with nothing turning or glowing. */
.aurora {
  box-shadow: var(--highlight), 0 0 0 1px var(--tint-line), var(--shadow-float);
}

/* A line of state over the content: a failed payment, a suspension, a trial. */
.notice {
  padding: 14px 18px;
  border-radius: var(--r-group);
  background: var(--orange-fill);
  color: var(--label);
  font-size: var(--callout);
  line-height: 1.5;
}

.notice.is-info {
  background: var(--tint-fill);
}

.notice.is-danger {
  background: var(--red-fill);
}

/* ------------------------------------------------------------ signed out --- */

.acct-gate {
  display: grid;
  gap: clamp(36px, 5vw, 72px);
  align-items: center;
}

@media (min-width: 940px) {
  .acct-gate {
    grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
    min-height: min(600px, calc(100vh - 240px));
  }
}

.acct-gate h1 {
  font-size: var(--title-page);
  line-height: 1.07;
}

.acct-gate .lede {
  margin-top: 20px;
}

/* ------------------------------------------------------------- signed in --- */

/* One column held to the page's width: an implicit column is sized to its
   widest content, and a long email address would widen every block. */
.acct-dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

/* The account arrives once, the moment it is known (the block stops being
   display:none): a fade, top to bottom. */
.acct-dash > * {
  animation: acct-in 520ms var(--ease-out-soft) backwards;
}

.acct-dash > :nth-child(2) { animation-delay: 40ms; }
.acct-dash > :nth-child(3) { animation-delay: 80ms; }
.acct-dash > :nth-child(n + 4) { animation-delay: 120ms; }

@keyframes acct-in {
  from {
    opacity: 0;
  }
}

.acct-head {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 8px;
}

.acct-who {
  flex: 1;
  min-width: 0;
}

/* The ellipsis needs overflow hidden, which clips descenders at the tight
   line box; the padding gives them room and the margin takes it back. */
.acct-email {
  overflow: hidden;
  padding-bottom: 0.2em;
  margin-bottom: -0.2em;
  font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: var(--track-title);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-who .caption {
  margin-top: 6px;
}

.avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(160deg, #3b3c41, #1d1e21);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.18), var(--shadow-float);
  color: #f5f5f7;
  font-size: 26px;
  font-weight: 600;
}

.avatar svg {
  width: 34px;
  height: 34px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 560px) {
  .acct-head {
    flex-wrap: wrap;
  }

  .avatar {
    width: 52px;
    height: 52px;
    font-size: 21px;
  }

  .avatar svg {
    width: 28px;
    height: 28px;
  }

  .acct-head > .button {
    width: 100%;
  }
}

/* -------------------------------------------------------------- sections --- */

.acct-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px 32px;
  align-items: start;
  margin-top: 16px;
}

@media (min-width: 900px) {
  .acct-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.panel-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.acct-section h2 {
  font-size: var(--title-3);
  letter-spacing: var(--track-title-3);
  line-height: 1.27;
}

.panel-head + .caption {
  margin-top: 4px;
  max-width: 56ch;
}

.acct-section .caption + .actions {
  margin-top: 16px;
}

/* The rows: one inset grouped list. */
.device-list {
  display: grid;
  padding: 0;
  margin: 16px 0 0;
  border-radius: var(--r-group);
  background: var(--surface);
  box-shadow: var(--highlight);
  list-style: none;
  overflow: hidden;
}

.device-list:empty {
  display: none;
}

.device-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 12px 12px 20px;
  transition: background-color var(--fast) var(--ease-out-soft), opacity 300ms var(--ease-out-soft),
    transform 300ms var(--ease-out-soft);
}

.device-row + .device-row {
  box-shadow: inset 74px 0 0 var(--surface), inset 0 0.5px 0 var(--hairline);
}

.device-row.is-confirming {
  background: var(--red-fill);
}

.device-row.is-leaving {
  opacity: 0;
  transform: translateX(16px);
}

/* On a phone the name gets the row's width and Remove drops under it. */
@media (max-width: 560px) {
  .device-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .device-remove {
    grid-column: 2;
    justify-self: start;
    min-height: 32px;
    margin: -6px 0 -4px -12px;
  }
}

.device-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-button);
  background: var(--fill-2);
  color: var(--label);
}

.device-icon svg {
  width: 20px;
  height: 20px;
}

/* A device with remote access wears the running green. */
.device-row:has(.dot-live) .device-icon {
  background: var(--green-fill);
  color: var(--green-ink);
}

.device-row[data-kind="computer"] .i-mobile,
.device-row[data-kind="mobile"] .i-computer,
.device-row[data-method]:not([data-method="email"]) .i-email,
.device-row[data-method]:not([data-method="github"]) .i-github,
.device-row[data-method]:not([data-method="google"]) .i-google,
.device-row[data-method]:not([data-method="apple"]) .i-apple {
  display: none;
}

.device-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.device-copy b {
  overflow: hidden;
  color: var(--label);
  font-size: var(--callout);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The state line wraps rather than clipping: "seen 19 days ago" comes last
   and is the part worth reading. */
.device-copy small {
  display: flex;
  gap: 7px;
  align-items: baseline;
  color: var(--label-2);
  font-size: var(--footnote);
  line-height: 1.45;
}

.device-copy small .dot {
  translate: 0 -1px;
}

.device-copy small .dot-live {
  animation: breathe 2.4s var(--ease-in-out) infinite;
}

.device-confirm {
  grid-column: 1 / -1;
  padding-top: 4px;
}

.device-confirm p:first-child {
  color: var(--label);
  font-size: var(--footnote);
  line-height: 1.5;
}

.device-confirm .actions {
  margin-top: 12px;
}

.device-empty {
  margin-top: 16px;
  padding: 20px;
  border-radius: var(--r-group);
  background: var(--fill-2);
  color: var(--label-2);
  font-size: var(--footnote);
  line-height: 1.5;
}

#link-open {
  margin: 10px 0 0 -12px;
}

.link-flow {
  margin-top: 8px;
}

.danger-zone {
  margin-top: 28px;
}

.danger-zone h3 {
  font-size: var(--headline);
  letter-spacing: var(--track-body);
}

.danger-zone .caption {
  max-width: 56ch;
  margin-top: 4px;
}

.danger-zone .button {
  margin: 8px 0 0 -12px;
}

@media (prefers-reduced-motion: reduce) {
  .device-copy small .dot-live,
  .acct-dash > * {
    animation: none;
  }
}
