.lightbox{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(10,14,22,.72);
  backdrop-filter: blur(10px);
  z-index: 9999;
}
.lightbox.is-open{ display: grid; }
.lightbox-inner{
  margin: 0;
  width: min(96vw, 1200px);
  height: min(90vh, 820px);
  display: grid;
  place-items: center;
}
.lightbox-inner img{
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* visa hela bilden */
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0,0,0,.35);
  background: rgba(255,255,255,.04);
}
.lightbox-nav,
.lightbox-close{
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.10);
  color: #fff;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}

.lightbox-inner{ position: relative; z-index: 1; }
.lightbox-close{
  top: 18px;
  right: 18px;
  font-size: 26px;
  line-height: 1;
}
.lightbox-nav{
  top: 50%;
  transform: translateY(-50%);
  font-size: 34px;
  line-height: 1;
}
.lightbox-nav.prev{ left: 18px; }
.lightbox-nav.next{ right: 18px; }
@media (max-width: 700px){
  .lightbox-nav{ width: 40px; height: 40px; font-size: 30px; }
}

/* Zoom button (matches nav style) */
.lightbox-zoom{
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 2;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.10);
  color: #fff;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 20px;
}
.lightbox-zoom[aria-pressed="true"]{
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.30);
}

/* Magnifier lens */
.lightbox-lens{
  position: fixed;
  z-index: 4; /* above the image + controls */
  width: 260px;
  height: 260px;
  border-radius: 999px;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  background-repeat: no-repeat;
  background-color: rgba(255,255,255,.06);
  display: none;
}

/* only show when zoom enabled and pointer over image */
.lightbox.is-zoom.lens-on .lightbox-lens{ display: block; }

@media (pointer: coarse){
  .lightbox-zoom{ display:none; }
}

/* ---------------------------------------------------------
   FIX: visa alltid HELA bilden i lightbox (ingen kapning)
   - vissa sidor laddar även layout.css som kan påverka .lightbox-inner
   - därför kör vi extra specifika regler här
--------------------------------------------------------- */
#lightbox .lightbox-inner{
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lightbox-img{
  width: auto !important;
  height: auto !important;
  max-width: min(96vw, 1200px);
  max-height: 88vh;
  object-fit: contain;
}

/* =========================================================
   FOOTER POPUP (Annonsvillkor / Integritet / Kontakt)
   Glass-effekt + skuggor, använder sidans gradient-variabler
   - Färgerna styrs via theme-runtime.css (tools)
   ========================================================= */

.dlg-wrap{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 10000;

  /* Mjuk mörkläggning + lätt blur bakom */
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.dlg-wrap[hidden]{ display: none; }
.dlg-wrap:not([hidden]){ display: flex; }

.dlg-box{
  width: clamp(320px, 33vw, 520px);
  height: min(72vh, 640px);
  border-radius: 18px;
  overflow: hidden;
  position: relative;

  /* Ljusare glass så svart text blir tydlig */
  background:
    linear-gradient(180deg, rgba(255,255,255,.62), rgba(255,255,255,.34)),
    linear-gradient(180deg,
      var(--page-grad-top, #2a143a),
      var(--page-grad-bottom, #f4eaff)
    );

  border: 1px solid rgba(255,255,255,.40);

  box-shadow:
    0 28px 80px rgba(0,0,0,.45),
    0 10px 30px rgba(0,0,0,.22),
    inset 0 1px 0 rgba(255,255,255,.30);

  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);

  animation: popFadeIn .20s ease-out;
}

/* Tydligt stängkryss med bra kontrast */
.dlg-x{
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;

  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.10);

  background: rgba(255,255,255,.70);
  color: #111;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;

  box-shadow: 0 10px 26px rgba(0,0,0,.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dlg-x:hover{
  background: rgba(255,255,255,.92);
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
}

/* Själva innehållet */
.dlg-cnt{
  height: 100%;
  padding: 18px 16px 16px;
  overflow: auto;

  /* Svart text = mycket bättre läsbarhet på ljus glass */
  color: #111;
  text-shadow: none;
}

/* Osynlig scrollbar men scroll funkar */
.dlg-cnt::-webkit-scrollbar{ width: 0; height: 0; }
.dlg-cnt{ scrollbar-width: none; -ms-overflow-style: none; }

/* Gör innehåll i popup “kort”-vänligt */
.dlg-cnt h1, .dlg-cnt h2, .dlg-cnt h3{
  margin: 0 0 10px 0;
  color: #0a0a0a;
}
.dlg-cnt p{ margin: 0 0 12px 0; }

.dlg-cnt a{
  color: #0b5ed7; /* läsbar standardlänk */
  text-decoration: underline;
}

/* Animation */
@keyframes popFadeIn{
  from{ opacity: 0; transform: translateY(10px) scale(.985); }
  to  { opacity: 1; transform: translateY(0) scale(1); }
}
