/* web/styles/picker.css */
/* Choosing a mark: the panel of icons and emoji, wherever one is chosen.
 *
 * A page's mark is chosen in the document frame and a workspace's in the settings over the shell,
 * so the panel is a stylesheet of its own that both load rather than a part of either.
 */

/* An emoji mark, wherever it is drawn, is drawn by a color emoji font: a text font that also holds
   the character (❤, ☺) would draw it in black and white. */
.page-emoji {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', emoji;
}

/* The catalogue of marks, opened beside the page's own icon.
 *
 * It stands over the page rather than inside the editor, so it is made of the theme's surfaces
 * rather than the editor's tokens, which do not reach outside the editor. A panel of marks needs
 * a surface of its own: drawn on the page, in the page's text colour, a shape cannot be told from
 * what is written under it. */
.haiyo-emoji {
  position: absolute;
  z-index: 30;
  width: 20rem;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--background);
  box-shadow: 0 10px 30px var(--shadow);
  color: var(--text);
}

.haiyo-emoji-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.haiyo-emoji-bar input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--background);
  color: var(--text);
  border-radius: 8px;
  font: inherit;
  font-size: 0.875rem;
}

.haiyo-emoji-bar button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.haiyo-emoji-grid {
  max-height: 16rem;
  overflow: auto;
}

/* A group of marks: the icons, one of the catalogue's groups, or what a search found. A group out
   of view is not laid out, so the whole catalogue opens as fast as its first screen. */
.haiyo-emoji-group {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  content-visibility: auto;
  contain-intrinsic-size: auto 20rem;
}

/* The emoji still arriving, said below the icons, in the words of a group's heading. */
.haiyo-emoji-arriving {
  margin: 8px 4px 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

.haiyo-emoji-group h3 {
  grid-column: 1 / -1;
  margin: 8px 4px 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.haiyo-emoji-group:first-child h3 {
  margin-top: 0;
}

.haiyo-emoji-grid button {
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 1.3rem;
  line-height: 1.4;
  cursor: pointer;
}

.haiyo-emoji-grid button:hover,
.haiyo-emoji-grid button:focus-visible {
  background: var(--raised);
  outline: none;
}

/* The marks on offer are drawn at a size that shows their shape, in the surrounding text colour. An
   emoji keeps its own colours. */
.haiyo-emoji-grid .page-glyph {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
}

.haiyo-emoji-grid button {
  display: grid;
  place-items: center;
}
