/*!
 * Schematic Parts – sp-lightbox.css
 * Path: assets/css/sp-lightbox.css
 */

@layer sp {
  .sp-lb-clickable {
    cursor: zoom-in;
  }

  #sp-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 99999;
  }

  #sp-lightbox.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #sp-lightbox .sp-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.86);
    cursor: zoom-out;
  }

  #sp-lightbox .sp-lb-figure {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    display: grid;
    place-items: center;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    pointer-events: none;
  }

  #sp-lightbox img {
    pointer-events: auto;
    width: auto;
    height: auto;
    max-width: min(92vw, 1200px);
    max-height: 84vh;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .45);
    will-change: transform;
  }

  #sp-lightbox .sp-lb-caption {
    pointer-events: none;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    margin: 0;
    padding: 0;
    color: rgba(255, 255, 255, .92);
    font-size: 13px;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .55);
    background: transparent;
    word-break: break-word;
  }

  #sp-lightbox .sp-lb-close {
    pointer-events: auto;
    position: fixed;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .35);
    background: rgba(0, 0, 0, .45);
    color: rgba(255, 255, 255, .92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    z-index: 2;
  }

  #sp-lightbox .sp-lb-close:hover {
    background: rgba(0, 0, 0, .65);
  }

  #sp-lightbox .sp-lb-close:active {
    transform: scale(.98);
  }

  html.sp-lb-open {
    overflow: hidden;
  }

  @media (max-width: 480px) {
    #sp-lightbox img {
      max-width: 94vw;
      max-height: 78vh;
      border-radius: 10px;
    }

    #sp-lightbox .sp-lb-close {
      width: 40px;
      height: 40px;
      top: 12px;
      right: 12px;
      font-size: 18px;
    }

    #sp-lightbox .sp-lb-caption {
      bottom: 12px;
      font-size: 12px;
    }
  }

/* Lightbox pildi mõõdud peavad jääma kontrolli alla ka teema img override'ide vastu */
  .sp-view #sp-lightbox img {
    width: auto !important;
    height: auto !important;
    max-width: min(92vw, 1200px) !important;
    max-height: 84vh !important;
  }
}
