@import url("/assets/lexxy-variables-099141e5.css");

:where(lexxy-editor) {
  --lexxy-editor-padding: 1ch;
  --lexxy-toolbar-gap: 2px;

  border: 1px solid var(--lexxy-color-ink-lighter);
  border-radius: calc(var(--lexxy-radius) + var(--lexxy-toolbar-gap));
  display: block;
  overflow: visible;
  position: relative;
  transition: opacity 150ms;

  input,
  button {
    &:focus-visible {
      outline-color: var(--lexxy-focus-ring-color);
    }
  }

  button,
  summary {
    -webkit-appearance: none;
    appearance: none;
    background: var(--lexxy-color-canvas);
    border: none;
    border-radius: var(--lexxy-radius);
    cursor: pointer;
    font-size: inherit;
    inline-size: auto;

    @media(any-hover: hover) {
      &:hover {
        filter: brightness(0.9);
      }
    }
  }

  .node--selected {
    &:has(img) img,
    &:not(:has(img)) {
      outline: var(--lexxy-focus-ring-size) solid var(--lexxy-focus-ring-color);
      outline-offset: var(--lexxy-focus-ring-offset);
    }
  }

  action-text-attachment {
    cursor: pointer;
  }
}

/* Placeholder */
:where(.lexxy-editor--empty) {
  .lexxy-editor__content:not(:has(ul, ol))::before {
    content: attr(placeholder);
    color: currentColor;
    cursor: text;
    opacity: 0.66;
    pointer-events: none;
    position: absolute;
    white-space: pre-line;
  }
}

:where(.lexxy-editor__content) {
  min-block-size: 8lh;
  outline: 0;
  padding: var(--lexxy-editor-padding);
}

:where(.lexxy-editor--drag-over) {
  background-color: var(--lexxy-color-selected);
  border-radius: var(--lexxy-radius);
  outline: 2px dashed var(--lexxy-color-selected-dark);
}

/* Toolbar
/* -------------------------------------------------------------------------- */

:where(lexxy-toolbar) {
  --lexxy-toolbar-icon-size: 1em;

  border-block-end: 1px solid var(--lexxy-color-ink-lighter);
  color: currentColor;
  display: flex;
  font-size: inherit;
  gap: var(--lexxy-toolbar-gap);
  max-inline-size: 100%;
  padding: 2px;
  position: relative;
}

:where(.lexxy-editor__toolbar-button) {
  aspect-ratio: 1;
  block-size: 2lh;
  color: currentColor;
  display: grid;
  place-items: center;

  &:is(:active) {
    background-color: var(--lexxy-color-selected);
  }

  &[aria-pressed="true"] {
    background-color: var(--lexxy-color-selected);
  }

  svg {
    -webkit-touch-callout: none;
    block-size: var(--lexxy-toolbar-icon-size);
    fill: currentColor;
    grid-area: 1/1;
    inline-size: var(--lexxy-toolbar-icon-size);
    user-select: none;
  }
}

:where(.lexxy-editor__toolbar-overflow) {
  display: none;
  position: relative;
  z-index: 1;

  summary {
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    [open] & {
      filter: brightness(0.9);
    }
  }
}

:where(.lexxy-editor__toolbar-overflow-menu) {
  background-color: var(--lexxy-color-canvas);
  border-radius: calc(var(--lexxy-radius) + var(--lexxy-toolbar-gap));
  box-shadow: var(--lexxy-shadow);
  display: flex;
  inset-inline-end: 0;
  padding: var(--lexxy-toolbar-gap);
  position: absolute;
}

/* Link dialog
/* -------------------------------------------------------------------------- */

:where(.lexxy-link-dialog) {
  display: contents;

  dialog {
    background-color: var(--lexxy-color-canvas);
    border: 1px solid var(--lexxy-color-ink-lighter);
    border-radius: var(--lexxy-radius);
    box-shadow: var(--lexxy-shadow);
    color: var(--lexxy-color-ink);
    padding: 1ch;
    position: absolute;
    z-index: 1;
  }

  .lexxy-dialog-actions {
    display: flex;
    font-size: var(--lexxy-text-small);
    flex: 1 1 0%;
    gap: 1ch;
    margin-block-start: 1ch;
  }

  input[type="url"],
  button {
    line-height: 1.5lh;
    padding-inline: 1ch;
  }

  input[type="url"] {
    border: 1px solid var(--lexxy-color-ink-lighter);
    border-radius: var(--lexxy-radius);
    min-inline-size: 30ch;
  }

  button {
    background-color: var(--lexxy-color-ink-lightest);
    inline-size: 100%;
    justify-content: center;
  }

  button[type="submit"] {
    background-color: var(--lexxy-color-accent-dark);
    color: var(--lexxy-color-ink-inverted);
  }
}

/* Language picker
/* -------------------------------------------------------------------------- */

:where(.lexxy-code-language-picker) {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--lexxy-color-canvas);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12 19.5c-.7 0-1.3-.3-1.7-.8l-9.8-11.1c-.7-.8-.6-1.9.2-2.6.8-.6 1.9-.6 2.5.2l8.6 9.8c0 .1.2.1.4 0l8.6-9.8c.7-.8 1.8-.9 2.6-.2s.9 1.8.2 2.6l-9.8 11.1c-.4.5-1.1.8-1.7.8z' fill='%23000'/%3E%3C/svg%3E");
  background-position: center right 1ch;
  background-repeat: no-repeat;
  background-size: 1ch;
  block-size: 1.5lh;
  border: 1px solid var(--lexxy-color-ink-lighter);
  border-radius: var(--lexxy-radius);
  color: var(--lexxy-color-ink);
  font-family: var(--lexxy-font-base);
  font-size: var(--lexxy-text-small);
  font-weight: normal;
  inset-inline-end: var(--lexxy-editor-padding);
  margin: 0.5ch 0.5ch 0 -0.5ch;
  padding: 0 2ch 0 1ch;
  text-align: start;

  @media (prefers-color-scheme: dark) {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12 19.5c-.7 0-1.3-.3-1.7-.8l-9.8-11.1c-.7-.8-.6-1.9.2-2.6.8-.6 1.9-.6 2.5.2l8.6 9.8c0 .1.2.1.4 0l8.6-9.8c.7-.8 1.8-.9 2.6-.2s.9 1.8.2 2.6l-9.8 11.1c-.4.5-1.1.8-1.7.8z' fill='%23fff'/%3E%3C/svg%3E");
  }
}

/* Prompt
/* ------------------------------------------------------------------------ */

:where(.lexxy-prompt-menu) {
  --lexxy-prompt-avatar-size: 24px;
  --lexxy-prompt-min-width: 20ch;
  --lexxy-prompt-padding: 0.5ch;

  background-color: var(--lexxy-color-canvas);
  border-radius: calc(var(--lexxy-prompt-padding) * 2);
  box-shadow: var(--lexxy-shadow);
  color: var(--lexxy-color-ink);
  font-family: var(--lexxy-font-base);
  font-size: var(--lexxy-text-small);
  list-style: none;
  margin: 0;
  max-block-size: 200px;
  min-inline-size: var(--lexxy-prompt-min-width);
  overflow: auto;
  padding: var(--lexxy-prompt-padding);
  visibility: hidden;
  z-index: var(--lexxy-z-popup);
}

:where(.lexxy-prompt-menu--visible) {
  visibility: initial;
}

:where(.lexxy-prompt-menu__item) {
  align-items: center;
  border-radius: var(--lexxy-radius);
  cursor: pointer;
  display: flex;
  gap: var(--lexxy-prompt-padding);
  padding: var(--lexxy-prompt-padding);
  white-space: nowrap;

  &:hover {
    background-color: var(--lexxy-color-ink-lightest);
  }

  &[aria-selected] {
    background-color: var(--lexxy-color-selected);
  }

  img {
    block-size: var(--lexxy-prompt-avatar-size);
    border-radius: 50%;
    flex-shrink: 0;
    inline-size: var(--lexxy-prompt-avatar-size);
    margin: 0;
  }

  + & {
    margin-top: 2px;
  }
}

:where(.lexxy-prompt-menu__item--empty) {
  color: var(--lexxy-color-ink-medium);
  padding: var(--lexxy-prompt-padding);
}
