/* The settings menu (the gear) and its rows: the pickers, the account and
   installing the site as an app. */

.picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.picker select {
  font: inherit;
  min-width: 120px;
  padding: 7px 10px;
  border: 1px solid #8886;
  border-radius: 9px;
  background: Canvas;
  color: CanvasText;
}

.picker button {
  padding: 7px 11px;
  border: 1px solid #8886;
  border-radius: 9px;
  background: Canvas;
  color: CanvasText;
  cursor: pointer;
}

.picker {
  color: var(--muted);
  font-weight: 650;
}

.picker select,
.picker button {
  border-color: var(--border);
  background: var(--surface-raised);
  color: var(--text);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.picker select:hover,
.picker button:hover {
  border-color: var(--brand);
}

.picker select:focus-visible,
.picker button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--butter);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .settings-panel {
    max-width: calc(100vw - 48px);
  }

  .picker select {
    flex: 1;
  }
}

.settings-menu {
  position: relative;
}

.settings-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
  transition: border-color 0.18s ease;
}

.settings-menu summary::-webkit-details-marker {
  display: none;
}

.settings-menu summary:hover,
.settings-menu[open] summary {
  border-color: var(--brand);
}

.settings-menu summary svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.settings-menu,
.settings-menu summary {
  min-width: 0;
}

#settings-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-panel {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: max-content;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.settings-panel .picker {
  justify-content: space-between;
  white-space: nowrap;
}

/* The account in the settings menu: which Google account it is, and the way
   out. Only there when the site has sign-in. */
.settings-panel .account {
  gap: 14px;
}

.picker[hidden] {
  display: none;
}

/* Installing the site as an app: a button, or on an iPhone the steps under
   the label. */
.settings-panel .install {
  display: grid;
  gap: 6px;
}

.settings-panel .install[hidden] {
  display: none;
}

/* The steps wrap to the width of the other rows instead of widening the
   panel, which would run off a phone's screen. */
.install-steps {
  width: 0;
  min-width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

#account-name {
  overflow: hidden;
  max-width: 220px;
  text-overflow: ellipsis;
}

@media (max-width: 620px) {
  .settings-menu {
    position: static;
  }

  .settings-panel {
    inset-inline: 0;
    width: auto;
    max-width: none;
  }

  .settings-panel label.picker {
    display: grid;
    justify-content: stretch;
    gap: 4px;
  }

  .settings-panel .picker select {
    width: 100%;
    min-width: 0;
  }

  .settings-panel .picker {
    min-width: 0;
  }

  #account-name {
    min-width: 0;
    max-width: none;
  }
}

.settings-menu summary {
  position: relative;
}
