#lsmg-suche {
  text-wrap: pretty;
}

.lsmg-suche__header {
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 1rem;
  margin-bottom: 2rem;
  position: relative;
}

@keyframes blink-empty {
  50% {
    background-size: 5px 1.2em;
    background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0));
  }
}

#lsmg-suche-input {
  animation: blink-empty 750ms infinite;
  background-image: linear-gradient(rgba(0, 0, 0, 1), rgba(0, 0, 0, 1));
  background-position: 1px center;
  background-repeat: no-repeat;
  background-size: 5px 1.2em;
  border-radius: 0;
  border: none;
  padding: 0.75em 0;
  font-family: "PT Mono", monospace;
  font-size: inherit;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 1;
  width: 100%;
  max-width: 50ch;
  line-height: 1;
}

#lsmg-suche-input:focus {
  animation: none;
  background-image: none;
  outline: none;
}

.lsmg-suche__keyword,
.lsmg-suche__button[type="button"] {
  appearance: none;
  background: none;
  border: none;
  font: inherit;
  font-size: 1.25rem;
  font-weight: normal;
  color: black;
  padding: 0;
  min-width: 3ch;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.lsmg-suche__keyword,
.lsmg-suche__button[type="button"]:active,
.lsmg-suche__button[type="button"]:focus,
.lsmg-suche__button[type="button"]:hover {
  background: none;
  border-radius: 0;
  border: none;
  color: #0009;
  padding: 0;
}

.lsmg-suche__keyword:hover,
.lsmg-suche__keyword:focus,
.lsmg-suche__keyword:active {
  background: none;
  font-weight: normal;
  text-decoration: none !important;
}

.lsmg-suche__keyword:hover span,
.lsmg-suche__keyword:focus span,
.lsmg-suche__keyword:active span {
  text-decoration: underline 2px !important;
  color: black;
}

.lsmg-suche__keyword.lsmg-suche__keyword {
  font-size: 12px;
  color: black;
  display: inline;
  word-break: auto;
  white-space: normal;
  line-height: inherit;
  text-align: left;
  position: relative;
}

#lsmg-suche-output figcaption {
  color: black;
  font-family: "PT Mono", monospace;
  font-weight: bold;
  font-style: normal;
  font-size: inherit;
  margin-top: 1rem;
  margin-left: 5rem;
}

#lsmg-suche-output .lsmg-suche__keywords figcaption,
#lsmg-suche-output .lsmg-suche__results figcaption {
  font-weight: normal;
}

#lsmg-suche-output figure img {
  background: white;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 20rem);
  object-fit: contain;
  object-position: left top;
}

@media screen and (max-width: 1000px) {
  #lsmg-suche-output figure img {
    max-height: calc(100vh - 25rem);
  }
}

@media screen and (max-width: 768px) {
  #lsmg-suche-output figure img {
    max-height: none;
  }
}

.lsmg-item--text blockquote {
  font-family: "Difficult Times";
  font-weight: normal;
  font-size: 4rem;
  line-height: 1;
  margin: 0;
  font-size: clamp(2rem, calc(100 / var(--text-length) * 12rem), 8rem);
  text-wrap: balance;
  text-wrap: pretty;
}

.lsmg-suche__results
  li:not(:last-of-type:first-of-type)
  .lsmg-item--text
  blockquote {
  font-size: 2vw;
}

.lsmg-suche__results .lsmg-item--text blockquote {
  line-height: 1.3;
}

/* on mobile we do fixed text size */
@media screen and (max-width: 1000px) {
  .lsmg-suche__results
    li:not(:last-of-type:first-of-type)
    .lsmg-item--text
    blockquote {
    font-size: 1.5rem;
  }
}

@media screen and (max-width: 2000px) {
  .lsmg-item--text blockquote {
    font-size: clamp(1rem, calc(100 / var(--text-length) * 11rem), 8rem);
  }
}

@media screen and (max-width: 1800px) {
  .lsmg-item--text blockquote {
    font-size: clamp(1rem, calc(100 / var(--text-length) * 10rem), 8rem);
  }
}

@media screen and (max-width: 1500px) {
  .lsmg-item--text blockquote {
    font-size: clamp(1rem, calc(100 / var(--text-length) * 9rem), 8rem);
  }
}

@media screen and (max-width: 1300px) {
  .lsmg-item--text blockquote {
    font-size: clamp(1rem, calc(100 / var(--text-length) * 5rem), 8rem);
  }
}

@media screen and (max-width: 768px) {
  .lsmg-item--text blockquote {
    font-size: clamp(1rem, calc(100 / var(--text-length) * 4rem), 4rem);
  }

  #lsmg-suche-output figcaption {
    margin-left: 2rem;
  }
}

.pbnm-page.pbnm-page main:has(#lsmg-suche) {
  max-width: none;
}

.lsmg-suche__results,
.lsmg-suche__keywords {
  list-style-type: none;
  padding: 0;
  margin: 0;
  columns: 3;
  gap: 1rem;
}

.lsmg-suche__keywords {
  font-family: "PT Mono", monospace;
  columns: 5;
}

.lsmg-suche__keywords li {
  line-height: 1.1;
}

.lsmg-suche__keywords li + li {
  margin-top: 0.5rem;
}

.lsmg-suche__keywords li:hover {
  font-weight: bold;
  text-decoration: none;
}

@media screen and (max-width: 1000px) {
  .lsmg-suche__results {
    columns: 2;
  }

  .lsmg-suche__keywords {
    columns: 3;
  }
}

@media screen and (max-width: 768px) {
  .lsmg-suche__results {
    columns: 1;
  }

  .lsmg-suche__keywords {
    columns: 2;
  }
}

.lsmg-suche__results:has(li:last-of-type:first-of-type) {
  columns: 1;
}

.lsmg-suche__results:has(li:last-of-type:first-of-type)
  .lsmg-suche__results
  figcaption {
  font-weight: bold;
}

#lsmg-suche-output .lsmg-suche__results figcaption {
  margin: 0.5rem 0;
}

.lsmg-suche__results li {
  margin-bottom: 2rem;
  break-inside: avoid;
}

#lsmg-suche-suggestions:empty {
  display: none;
}

#lsmg-suche-suggestions {
  list-style-type: none;
  position: absolute;
  padding: 0.5rem;
  margin: 0;
  left: 3rem;
  top: calc(100% - 1px);
  background: white;
  font-family: "PT Mono", monospace;
  font-weight: bold;
  height: max-content;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - 10rem);
  max-width: 350px;
  z-index: 3;
}

#lsmg-suche-suggestions .lsmg-suche__keyword:focus {
  outline: none;
}

#lsmg-suche img.lsmg-suche__image-preview {
  position: fixed;
  display: block;
  max-width: 200px;
  z-index: 2;
  top: 0;
  left: 0;
}

span + .lsmg-suche__keyword::before,
.lsmg-suche__keyword + .lsmg-suche__keyword::before {
  content: "; ";
}

#lsmg-suche-random {
  aspect-ratio: 1;
  padding-top: 0.35rem;
}
