/* Lektor docs: responsive figures (Grav resize=… is applied at migrate time where possible) */
#body-inner img {
  box-sizing: border-box;
  max-width: 100%;
  height: auto;
  cursor: zoom-in;
}

/* Linked images keep normal pointer (navigation / existing lightbox links) */
#body-inner a[href] img {
  cursor: pointer;
}

#body-inner p img,
#body-inner li img {
  vertical-align: middle;
}

/*
 * Top bar + language flag
 * Learn2: #top-bar is flex + min-height: 3rem; the flag sat in the flex row and could
 * match that cross-size. Take #lang-switcher out of flex (position:absolute) so the
 * grey bar height follows only breadcrumbs + padding; flag is a small overlay on the right.
 */
#top-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  min-height: 0 !important;
  padding: 0.35rem 1rem;
  padding-right: 3rem;
  box-sizing: border-box;
}

section#body #top-bar #breadcrumbs {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  position: static !important;
  top: auto !important;
  transform: none !important;
  -webkit-transform: none !important;
  -moz-transform: none !important;
  -ms-transform: none !important;
  -o-transform: none !important;
}

#top-bar .lang-switcher {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  width: auto;
  height: auto;
  line-height: 0;
}

/* Learn2 kann die Button-Höhe strecken — feste Kachel für Globus/Flagge beibehalten */
section#body #top-bar .lang-switcher__btn {
  height: 22px !important;
  min-height: 22px !important;
  max-height: none !important;
}

/* Globe sichtbar, Ziel-Flagge per Hover/Fokus (layout.html) */
.lang-switcher__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  padding: 2px;
  line-height: 0;
  background: #fff;
  border: 1px solid #cfd4d8;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  text-decoration: none;
  vertical-align: middle;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.lang-switcher__globe {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 15px;
  line-height: 1;
  color: #2c3e50;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.lang-switcher__btn:hover .lang-switcher__globe,
.lang-switcher__btn:focus-visible .lang-switcher__globe {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .lang-switcher__globe,
  #body #top-bar .lang-switcher__btn .lang-switcher__flag {
    transition: none;
  }
}

.lang-switcher__btn:hover {
  border-color: #95a5a6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.lang-switcher__btn:focus-visible {
  outline: 2px solid #3498db;
  outline-offset: 2px;
}

/*
 * Learn2 theme.css: #body img { margin: 1.5rem auto; } — Flag ausnehmen;
 * Hover: Flagge einblenden (Globus ausblenden).
 */
#body #top-bar .lang-switcher__btn .lang-switcher__flag {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0 !important;
  width: 20px;
  height: 12px;
  max-width: none;
  object-fit: contain;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

#body #top-bar .lang-switcher__btn:hover .lang-switcher__flag,
#body #top-bar .lang-switcher__btn:focus-visible .lang-switcher__flag {
  opacity: 1;
}

/* Client-side search (assets/js/docs-search.js + search-index.json from migrate) */
#sidebar .searchbox {
  position: relative;
  z-index: 2;
}

.docs-search-results {
  box-sizing: border-box;
  max-height: 45vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  color: #333;
  font-size: 13px;
  text-align: left;
}

.docs-search-results__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.docs-search-results__item a {
  display: block;
  padding: 0.45rem 0.75rem;
  color: #2c3e50 !important;
  text-decoration: none;
}

.docs-search-results__item a:hover {
  background: #f0f2f4;
}

.docs-search-results__title {
  display: block;
  font-weight: 600;
}

.docs-search-results__snippet {
  display: block;
  margin-top: 0.25rem;
  font-weight: 400;
  color: #666;
  font-size: 12px;
  line-height: 1.35;
}

.docs-search-results__empty {
  padding: 0.75rem;
  color: #888;
}

/* Search hit highlight on target page (?q=… from sidebar search; learn.js jQuery.highlight) */
#body-inner mark.highlight {
  background: #fff59d;
  padding: 0 0.15em;
  border-radius: 2px;
  scroll-margin-top: 5rem;
}

/*
 * Featherlight: keep enlarged images inside the viewport (default uses width:100% and
 * overflow:auto on .featherlight-content, which yields page-like scrollbars for tall images).
 */
.featherlight .featherlight-content {
  max-width: min(92vw, 100%);
  max-height: 92vh;
  overflow: hidden;
  box-sizing: border-box;
}

.featherlight .featherlight-inner {
  max-width: 100%;
  max-height: calc(92vh - 50px);
  box-sizing: border-box;
}

.featherlight .featherlight-image {
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: calc(92vh - 50px);
  object-fit: contain;
  vertical-align: middle;
}

@media only screen and (max-width: 1024px) {
  .featherlight .featherlight-inner,
  .featherlight .featherlight-image {
    max-height: calc(98vh - 40px);
  }
}
