.ha-vacancy-gallery-trigger {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.ha-vacancy-gallery-trigger img {
  display: block;
}

.ha-vacancy-gallery-trigger:focus-visible {
  outline: 4px solid var(--ha-secondary);
  outline-offset: 4px;
}

.ha-vacancy-gallery-view {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.76rem 1.08rem;
  border: 1px solid rgba(16, 43, 58, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(16, 43, 58, 0.22);
  color: var(--ha-navy);
  font-size: 0.86rem;
  font-weight: 850;
  backdrop-filter: blur(8px);
}

.ha-gallery-modal[hidden] {
  display: none;
}

.ha-gallery-modal {
  position: fixed;
  z-index: 99999;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
}

.ha-gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 13, 21, 0.94);
  backdrop-filter: blur(10px);
}

.ha-gallery-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1540px, calc(100vw - 32px));
  height: min(94dvh, 980px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  background: #061a27;
  box-shadow: 0 32px 110px rgba(0, 0, 0, 0.62);
}

.ha-gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 70px;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(4, 24, 36, 0.98);
  color: #fff;
}

.ha-gallery-toolbar > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  min-width: 0;
}

.ha-gallery-toolbar p {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 1rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ha-gallery-counter {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.ha-gallery-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 0 0 auto;
}

.ha-gallery-escape {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
}

.ha-gallery-escape kbd {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  min-height: 25px;
  margin-right: 0.2rem;
  padding: 0 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  font-weight: 800;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.16);
}

.ha-gallery-close,
.ha-gallery-nav,
.ha-gallery-thumbnail {
  border: 0;
  color: #fff;
  cursor: pointer;
}

.ha-gallery-close {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.55rem 0.72rem 0.55rem 0.92rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  font-weight: 800;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.ha-gallery-close span:last-child {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
}

.ha-gallery-close:hover,
.ha-gallery-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ha-gallery-close:focus-visible,
.ha-gallery-nav:focus-visible,
.ha-gallery-thumbnail:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.ha-gallery-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 18px 84px;
  overflow: hidden;
  background:
    radial-gradient(
      circle at 50% 40%,
      rgba(38, 83, 106, 0.34),
      transparent 55%
    ),
    #041621;
}

.ha-gallery-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  object-fit: contain;
  opacity: 1;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.34);
  transition: opacity 0.15s ease;
}

.ha-gallery-stage img.is-loading {
  opacity: 0.45;
}

.ha-gallery-nav {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(3, 25, 38, 0.76);
  font-size: 1.8rem;
  transform: translateY(-50%);
  transition:
    background 0.2s ease,
    transform 0.2s ease;
  backdrop-filter: blur(8px);
}

.ha-gallery-nav:hover {
  transform: translateY(-50%) scale(1.04);
}

.ha-gallery-previous {
  left: 18px;
}

.ha-gallery-next {
  right: 18px;
}

.ha-gallery-footer {
  min-height: 92px;
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(4, 24, 36, 0.99);
}

.ha-gallery-caption {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
}

.ha-gallery-thumbnails {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 92px;
  justify-content: safe center;
  gap: 8px;
  max-width: 100%;
  padding: 3px 2px 5px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  scrollbar-width: thin;
}

.ha-gallery-thumbnail {
  position: relative;
  display: block;
  width: 92px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.09);
  opacity: 0.58;
  transition:
    opacity 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.ha-gallery-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ha-gallery-thumbnail:hover,
.ha-gallery-thumbnail.is-current {
  border-color: #fff;
  opacity: 1;
}

.ha-gallery-thumbnail:hover {
  transform: translateY(-1px);
}

.ha-gallery-open {
  overflow: hidden;
}

@media (max-width: 760px) {
  .ha-gallery-modal {
    padding: 0;
  }

  .ha-gallery-dialog {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .ha-gallery-toolbar {
    min-height: 62px;
    padding: 9px 10px 9px 14px;
  }

  .ha-gallery-toolbar p {
    max-width: 48vw;
    font-size: 0.9rem;
  }

  .ha-gallery-escape {
    display: none;
  }

  .ha-gallery-close {
    min-height: 40px;
    padding-left: 0.8rem;
  }

  .ha-gallery-stage {
    padding: 10px 48px;
  }

  .ha-gallery-nav {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .ha-gallery-previous {
    left: 4px;
  }

  .ha-gallery-next {
    right: 4px;
  }

  .ha-gallery-footer {
    min-height: 79px;
    padding-inline: 8px;
  }

  .ha-gallery-thumbnails {
    grid-auto-columns: 72px;
    justify-content: start;
  }

  .ha-gallery-thumbnail {
    width: 72px;
    border-radius: 7px;
  }

  .ha-vacancy-gallery-view {
    right: 10px;
    bottom: 10px;
    padding: 0.62rem 0.86rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ha-gallery-close,
  .ha-gallery-nav,
  .ha-gallery-thumbnail {
    transition: none;
  }
}
