/* stylelint-disable no-descending-specificity */

/* ===== Basic ===== */
:root {
  --twoslash-border-color: var(--vp-c-divider);
  --twoslash-jsdoc-color: #888;
  --twoslash-underline-color: currentcolor;
  --twoslash-popup-bg: var(--vp-c-neutral-inverse);
  --twoslash-popup-shadow: var(--vp-shadow-2);
  --twoslash-matched-color: inherit;
  --twoslash-unmatched-color: #888;
  --twoslash-cursor-color: #8888;
  --twoslash-error-color: var(--vp-c-danger-1);
  --twoslash-error-bg: var(--vp-c-danger-soft);
  --twoslash-tag-color: var(--vp-c-tip-1);
  --twoslash-tag-bg: var(--vp-c-tip-soft);
  --twoslash-tag-warn-color: var(--vp-c-warning-1);
  --twoslash-tag-warn-bg: var(--vp-c-warning-soft);
  --twoslash-tag-annotate-color: var(--vp-c-green-1);
  --twoslash-tag-annotate-bg: var(--vp-c-green-soft);
  --twoslash-highlighted-bg: var(--vp-c-gray-soft);
  --twoslash-highlighted-border: var(--vp-c-border);
}

/* Respect people's wishes to not have animations */
@media (prefers-reduced-motion: reduce) {
  .twoslash * {
    transition: none !important;
  }
}

/* ===== Hover Info ===== */
.twoslash:hover .twoslash-hover {
  border-color: var(--twoslash-underline-color);
}

.twoslash .twoslash-hover {
  position: relative;
  border-bottom: 1px dotted transparent;
  transition: border-color 0.3s;
  transition-timing-function: ease;
}

.twoslash .twoslash-popup-container {
  position: absolute;
  z-index: 10;
  display: inline-flex;
  flex-direction: column;
  text-align: left;
  pointer-events: none;
  user-select: none;
  background: var(--twoslash-popup-bg);
  border: 1px solid var(--twoslash-border-color);
  border-radius: 4px;
  box-shadow: var(--twoslash-popup-shadow);
  opacity: 0;
  transition: opacity 0.3s;
  transform: translateY(1.5em);
}

.twoslash .twoslash-query-presisted .twoslash-popup-container {
  left: 50%;
  z-index: 9;
  transform: translate(-1.3em, 1.8em);
}

.twoslash .twoslash-hover:hover .twoslash-popup-container,
.twoslash .twoslash-query-presisted .twoslash-popup-container {
  pointer-events: auto;
  opacity: 1;
}

.twoslash .twoslash-popup-container:hover {
  user-select: auto;
}

.twoslash .twoslash-popup-arrow {
  position: absolute;
  top: -4px;
  left: 1em;
  width: 6px;
  height: 6px;
  pointer-events: none;
  background: var(--twoslash-popup-bg);
  border-top: 1px solid var(--twoslash-border-color);
  border-right: 1px solid var(--twoslash-border-color);
  transform: rotate(-45deg);
}

.twoslash .twoslash-popup-code,
.twoslash .twoslash-popup-docs {
  padding: 6px 8px !important;
}

.twoslash .twoslash-popup-docs {
  font-family: sans-serif;
  font-size: 0.8em;
  color: var(--twoslash-jsdoc-color);
  border-top: 1px solid var(--twoslash-border-color);
}

.twoslash .twoslash-popup-docs-tags {
  display: flex;
  flex-direction: column;
}

.twoslash .twoslash-popup-docs-tags,
.twoslash .twoslash-popup-docs-tag-name {
  margin-right: 0.5em;
}

/* ===== Error Line ===== */
.twoslash .twoslash-error-line {
  position: relative;
  padding: 6px;
  margin: 0.2em 0;
  color: var(--twoslash-error-color);
  background-color: var(--twoslash-error-bg);
  border-left: 3px solid var(--twoslash-error-color);
}

.twoslash .twoslash-error {
  padding-bottom: 2px;
  background: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%206%203'%20enable-background%3D'new%200%200%206%203'%20height%3D'3'%20width%3D'6'%3E%3Cg%20fill%3D'%23c94824'%3E%3Cpolygon%20points%3D'5.5%2C0%202.5%2C3%201.1%2C3%204.1%2C0'%2F%3E%3Cpolygon%20points%3D'4%2C0%206%2C2%206%2C0.6%205.4%2C0'%2F%3E%3Cpolygon%20points%3D'0%2C2%201%2C3%202.4%2C3%200%2C0.6'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") repeat-x bottom left;
}

/* ===== Completeions ===== */
.twoslash .twoslash-completion-cursor {
  position: relative;
}

.twoslash .twoslash-completion-cursor .twoslash-completion-list {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 8;
  display: inline-block;
  margin: 3px 0 0 -1px;
  user-select: none;
  background: var(--twoslash-popup-bg);
  border: 1px solid var(--twoslash-border-color);
  box-shadow: var(--twoslash-popup-shadow);
  transform: translate(0, 1.2em);
}

.twoslash-completion-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 240px;
  padding: 4px;
  font-size: 0.8rem;
}

.twoslash-completion-list:hover {
  user-select: auto;
}

.twoslash-completion-list::before {
  position: absolute;
  top: -1.6em;
  left: -1px;
  width: 2px;
  height: 1.4em;
  content: " ";
  background-color: var(--twoslash-cursor-color);
}

.twoslash-completion-list li {
  display: flex;
  gap: 0.25em;
  align-items: center;
  overflow: hidden;
  line-height: 1em;
}

.twoslash-completion-list li span.twoslash-completions-unmatched {
  color: var(--twoslash-unmatched-color);
}

.twoslash-completion-list .deprecated {
  text-decoration: line-through;
  opacity: 0.5;
}

.twoslash-completion-list li span.twoslash-completions-matched {
  color: var(--twoslash-matched-color);
}

/* Highlights */
.twoslash-highlighted {
  padding: 1px 2px;
  margin: -1px -3px;
  background-color: var(--twoslash-highlighted-bg);
  border: 1px solid var(--twoslash-highlighted-border);
  border-radius: 4px;
}

/* Icons */
.twoslash-completion-list .twoslash-completions-icon {
  flex: none;
  width: 1em;
  color: var(--twoslash-unmatched-color);
}

/* Custom Tags */
.twoslash .twoslash-tag-line {
  position: relative;
  display: flex;
  gap: 0.3em;
  align-items: center;
  padding: 6px 10px;
  margin: 0.2em 0;
  color: var(--twoslash-tag-color);
  background-color: var(--twoslash-tag-bg);
  border-left: 3px solid var(--twoslash-tag-color);
}

.twoslash .twoslash-tag-line .twoslash-tag-icon {
  width: 1.1em;
  color: inherit;
}

.twoslash .twoslash-tag-line.twoslash-tag-error-line {
  color: var(--twoslash-error-color);
  background-color: var(--twoslash-error-bg);
  border-left: 3px solid var(--twoslash-error-color);
}

.twoslash .twoslash-tag-line.twoslash-tag-warn-line {
  color: var(--twoslash-tag-warn-color);
  background-color: var(--twoslash-tag-warn-bg);
  border-left: 3px solid var(--twoslash-tag-warn-color);
}

.twoslash .twoslash-tag-line.twoslash-tag-annotate-line {
  color: var(--twoslash-tag-annotate-color);
  background-color: var(--twoslash-tag-annotate-bg);
  border-left: 3px solid var(--twoslash-tag-annotate-color);
}

/* ========== floating vue ================== */
:root {
  --twoslash-popup-bg: var(--vp-c-bg, inherit);
  --twoslash-popup-color: var(--vp-c-text-1);
  --twoslash-docs-color: var(--vp-c-text-1);
  --twoslash-docs-font: var(--vp-font-family-base);
  --twoslash-code-font: var(--vp-font-family-mono);
  --twoslash-code-size: var(--vp-code-font-size);
  --twoslash-underline-color: #8888;
  --twoslash-border-color: var(--vp-c-border);
  --twoslash-cursor-color: var(--vp-c-brand-1);
  --twoslash-matched-color: var(--vp-c-brand-1);
  --twoslash-unmatched-color: var(--vp-c-text-2);
}

.v-popper--theme-twoslash {
  z-index: calc(var(--vp-z-index-local-nav) - 1);
}

.v-popper--theme-twoslash .v-popper__inner {
  color: var(--twoslash-popup-color);
  background: var(--twoslash-popup-bg);
  border-color: var(--twoslash-border-color);
}

.v-popper--theme-twoslash .v-popper__arrow-outer {
  border-color: var(--twoslash-border-color);
}

.v-popper--theme-twoslash .v-popper__arrow-inner {
  border-color: var(--twoslash-popup-bg);
}

.twoslash-popup-container {
  transform: translateY(1.5em);
}

.twoslash-query-presisted .twoslash-popup-container {
  transform: translateY(1.8em);
}

.twoslash .v-popper {
  display: inline-block;
}

.twoslash-completion-list .twoslash-completions-icon {
  color: var(--twoslash-unmatched-color) !important;
}

.twoslash-floating .twoslash-popup-code {
  display: block;
  width: fit-content;
  min-width: 100%;
  max-width: 600px;
  padding: 6px 12px;
  font-size: var(--twoslash-code-size);
  line-height: var(--vp-code-line-height);
  white-space: pre-wrap;
  transition: color 0.5s;
}

.twoslash-floating .twoslash-popup-docs,
.twoslash-floating .twoslash-popup-error {
  max-width: 700px;
  max-height: 500px;
  padding: 12px !important;
  overflow: hidden auto;
  font-family: var(--twoslash-docs-font);
  font-size: 0.9em;
  text-wrap: balance;
}

.twoslash-floating .twoslash-popup-docs p:first-child,
.twoslash-floating .twoslash-popup-error p:first-child {
  margin-top: 0;
}

.twoslash-floating .twoslash-popup-docs p:last-child,
.twoslash-floating .twoslash-popup-error p:last-child {
  margin-bottom: 0;
}

.twoslash-floating .twoslash-popup-docs {
  color: var(--twoslash-docs-color);
  border-top: 1px solid var(--twoslash-border-color);
}

.twoslash-floating .twoslash-popup-error {
  color: var(--twoslash-error-color);
}

.twoslash-floating .twoslash-popup-error.twoslash-error-level-warning {
  color: var(--twoslash-warn-color);
}

.twoslash-floating .twoslash-popup-docs p,
.twoslash-floating .twoslash-popup-error p {
  margin: 6px 0;
  text-wrap: balance;
}

.twoslash-floating .twoslash-popup-docs pre .twoslash-floating .twoslash-popup-error pre {
  padding: 12px;
  margin: 6px -2px;
  overflow-x: auto;
  background-color: var(--vp-code-block-bg);
  border-radius: 8px;
}

.twoslash-floating .twoslash-popup-docs-tags {
  display: flex;
  flex-direction: column;
  padding: 8px 12px !important;
}

.twoslash-floating .twoslash-popup-docs-tags .twoslash-popup-docs-tag-name {
  margin-right: 0.5em;
  font-family: var(--twoslash-code-font);
  color: var(--twoslash-unmatched-color);
}

.twoslash-completion-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  margin-bottom: -0.2em;
  user-select: none;
  background: var(--twoslash-cursor-color);
}

.twoslash-floating.twoslash-completion .v-popper__arrow-container {
  display: none;
}

.twoslash-floating.twoslash-completion .twoslash-completion-list {
  padding: 6px;
  font-family: var(--twoslash-code-font);
  font-size: var(--twoslash-code-size) !important;
}

.twoslash-floating.twoslash-completion .twoslash-completion-list li {
  padding: 3px 0;
}
