:root {
  --jhp-body-bg: Canvas;
  --jhp-body-color: CanvasText;
  --jhp-header-bg: ButtonFace;
  --jhp-link-color: LinkText;
  --jhp-border-color: color-mix(in srgb, CanvasText 18%, transparent);
  --jhp-shadow-color: color-mix(in srgb, CanvasText 28%, transparent);
  --jhp-accent-hover: color-mix(in srgb, CanvasText 10%, transparent);
  --jhp-error-color: #b00020;
  --jhp-font-family: inherit;
  --jhp-font-size: inherit;
  --jhp-line-height: inherit;
}

.jhp-hwin {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  max-width: min(92vw, 900px);
  box-shadow: 0 0 12px 0 var(--jhp-shadow-color);
  background: var(--jhp-body-bg);
  color: var(--jhp-body-color);
  font-family: var(--jhp-font-family);
  font-size: var(--jhp-font-size);
  line-height: var(--jhp-line-height);
  border: 1px solid var(--jhp-border-color);
  animation: jhp-fade-in 150ms ease-out;
  color-scheme: inherit;
}

@keyframes jhp-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.jhp-border {
  position: relative;
  flex-shrink: 0;
  min-height: 3px;
}

.jhp-border--top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 1.25rem;
  max-height: 1.25rem;
  padding: 0 0.25rem;
  background: var(--jhp-header-bg);
  border-bottom: 1px solid var(--jhp-border-color);
  user-select: none;
  cursor: default;
}

.jhp-hwin__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.jhp-hwin[data-perm="true"] .jhp-border--top {
  cursor: move;
}

.jhp-hwin__rollup {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 220ms ease;
  min-height: 0;
}

.jhp-hwin--rolled-up .jhp-hwin__rollup {
  grid-template-rows: 0fr;
}

.jhp-hwin__rollup-inner {
  overflow: hidden;
  min-height: 0;
}

.jhp-hwin--rolled-up .jhp-resize {
  display: none;
}

.jhp-border--bottom {
  min-height: 3px;
  border-top: 1px solid var(--jhp-border-color);
  background: var(--jhp-header-bg);
}

.jhp-hwin__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 600;
  display: block;
}

.jhp-hwin[data-perm="false"] .jhp-hwin__title {
  font-weight: 500;
  opacity: 0.85;
}

.jhp-hwin__actions {
  display: none;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.jhp-hwin[data-perm="true"] .jhp-hwin__actions {
  display: flex;
}

.jhp-hwin__btn {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.6875rem;
  line-height: 1;
  padding: 0.125rem 0.25rem;
  cursor: pointer;
  border-radius: 2px;
  text-decoration: none;
}

.jhp-hwin__btn:hover,
.jhp-hwin__btn:focus-visible {
  background: var(--jhp-accent-hover);
  outline: none;
}

.jhp-hwin__btn--link {
  color: var(--jhp-link-color);
  font-weight: 600;
}

.jhp-hwin__content {
  overflow: auto;
  contain: paint;
  max-height: 92vh;
  min-height: 20px;
  padding: 0.75rem 1rem;
  background: var(--jhp-body-bg);
  color: var(--jhp-body-color);
}

/* Fix for floating bullet points.
   JTD list markers use absolute ::before pseudo-elements. Without
   position: relative on li, they anchor to .jhp-hwin (position: fixed)
   and stay put while the scrollable text moves. */
.jhp-hwin__content ul > li,
.jhp-hwin__content ol > li {
  position: relative;
}

.jhp-hwin__content main,
.jhp-hwin__content .jhp-section {
  margin: 0;
}

.jhp-hwin__content h1,
.jhp-hwin__content h2,
.jhp-hwin__content h3,
.jhp-hwin__content h4,
.jhp-hwin__content h5,
.jhp-hwin__content h6 {
  margin-top: 0;
}

.jhp-hwin__content .anchor-heading {
  display: none;
}

.jhp-hwin__loading {
  padding: 1rem;
  font-size: 0.8125rem;
  opacity: 0.7;
}

.jhp-hwin__error {
  padding: 1rem;
  font-size: 0.8125rem;
  color: var(--jhp-error-color);
}

.jhp-resize {
  position: absolute;
  touch-action: none;
}

.jhp-resize-n {
  top: -4px;
  right: 4px;
  left: 4px;
  height: 4px;
  cursor: ns-resize;
}

.jhp-resize-ne {
  top: -6px;
  right: -6px;
  width: 10px;
  height: 10px;
  cursor: ne-resize;
}

.jhp-resize-e {
  top: 4px;
  right: -4px;
  bottom: 4px;
  width: 4px;
  cursor: ew-resize;
}

.jhp-resize-se {
  right: -6px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  cursor: se-resize;
}

.jhp-resize-s {
  bottom: 1px;
  right: 4px;
  left: 4px;
  height: 2px;
  cursor: ns-resize;
}

.jhp-resize-sw {
  bottom: -6px;
  left: -6px;
  width: 10px;
  height: 10px;
  cursor: sw-resize;
}

.jhp-resize-w {
  top: 4px;
  bottom: 4px;
  left: -4px;
  width: 4px;
  cursor: ew-resize;
}

.jhp-resize-nw {
  top: -6px;
  left: -6px;
  width: 10px;
  height: 10px;
  cursor: nw-resize;
}

@media (pointer: coarse) {
  .jhp-resize-n,
  .jhp-resize-s {
    height: 8px;
  }

  .jhp-resize-e,
  .jhp-resize-w {
    width: 8px;
  }

  .jhp-resize-ne,
  .jhp-resize-nw,
  .jhp-resize-se,
  .jhp-resize-sw {
    width: 16px;
    height: 16px;
  }
}
