:root {
  --sgwip-safe-top: env(safe-area-inset-top, 0px);
  --sgwip-safe-right: env(safe-area-inset-right, 0px);
  --sgwip-safe-bottom: env(safe-area-inset-bottom, 0px);
  --sgwip-safe-left: env(safe-area-inset-left, 0px);
}

body.sgwip-active,
body.sgwip-standalone {
  margin: 0 !important;
  background: #000 !important;
}

body.sgwip-standalone > *:not(.sgwip-stage):not(script):not(style):not(link) {
  max-width: none;
}

.sgwip-access {
  position: fixed;
  top: calc(var(--sgwip-safe-top) + 14px);
  right: calc(var(--sgwip-safe-right) + 14px);
  z-index: 9999;
}

.sgwip-access-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.56);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}

.sgwip-access-btn:hover,
.sgwip-access-btn:focus {
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  text-decoration: none;
}

.sgwip-stage {
  box-sizing: border-box;
  width: 100%;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--sgwip-bg, #000);
  padding: var(--sgwip-safe-top) var(--sgwip-safe-right) var(--sgwip-safe-bottom) var(--sgwip-safe-left);
}

.sgwip-picture {
  display: block;
  width: min(100%, var(--sgwip-max, 1920px));
  height: auto;
  line-height: 0;
}

.sgwip-picture img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100svh;
  object-fit: contain;
  object-position: center;
}

@media (max-width: 767px) {
  .sgwip-stage {
    min-height: 100dvh;
    align-items: start;
    padding-top: calc(var(--sgwip-safe-top) + 8px);
    padding-left: calc(var(--sgwip-safe-left) + 10px);
    padding-right: calc(var(--sgwip-safe-right) + 10px);
    padding-bottom: calc(var(--sgwip-safe-bottom) + 10px);
  }

  .sgwip-access {
    top: calc(var(--sgwip-safe-top) + 12px);
    right: calc(var(--sgwip-safe-right) + 12px);
  }

  .sgwip-access-btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .sgwip-picture,
  .sgwip-picture img {
    width: 100%;
    max-width: none;
  }

  .sgwip-picture img {
    min-height: auto;
    max-height: calc(100dvh - var(--sgwip-safe-top) - var(--sgwip-safe-bottom) - 20px);
    object-fit: contain;
    object-position: left top;
  }
}

/* La pagina dedicata deve essere realmente a tutta larghezza anche con temi restrittivi. */
body.sgwip-active .site,
body.sgwip-active .site-content,
body.sgwip-active .content-area,
body.sgwip-active main,
body.sgwip-active article,
body.sgwip-active .entry-content {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.sgwip-active .entry-header,
body.sgwip-active .site-header,
body.sgwip-active .site-footer,
body.sgwip-active .widget-area,
body.sgwip-active .entry-title {
  display: none !important;
}
