/* =========================================================
   UNIVERSAL POPUP
   PC / SP
========================================================= */

:root {
  --popup-overlay: rgba(0, 0, 0, 0.92);
  --popup-bg: #ffffff;
  --popup-text: #222222;
  --popup-accent: #ffffff;
  --popup-close-bg: rgba(0, 0, 0, 0.55);
  --popup-close-line: rgba(255, 255, 255, 0.55);
  --popup-close-icon: #ffffff;
  --popup-arrow-bg: rgba(0, 0, 0, 0.45);
  --popup-arrow-bg-hover: rgba(0, 0, 0, 0.80);
  --popup-arrow-color: #ffffff;
  --popup-thumb-line: #ffffff;
}

.popup-image,
.popup-gallery {
  cursor: zoom-in;
  transition: opacity 0.25s ease;
}

.popup-image:hover,
.popup-gallery:hover {
  opacity: 0.88;
}

.popup-text-open,
.popup-youtube-open {
  cursor: pointer;
}

.popup-source {
  display: none;
}

.md-popup,
.md-popup * {
  box-sizing: border-box;
}

.md-popup {
  position: fixed;
  z-index: 30000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.30s ease,
    visibility 0.30s ease;
}

.md-popup.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.md-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--popup-overlay);
  font-size: 0;
  line-height: 0;
  cursor: pointer;
}

.md-popup-box {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90%;
  max-width: 900px;
  max-height: 88vh;
  overflow: auto;
  background: var(--popup-bg);
  color: var(--popup-text);
  opacity: 0;
  transform: translate(-50%, -48%);
  transition:
    opacity 0.30s ease,
    transform 0.30s ease;
}

.md-popup.is-open .md-popup-box {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.md-popup-box.popup-small {
  max-width: 600px;
}

.md-popup-box.popup-normal {
  max-width: 900px;
}

.md-popup-box.popup-wide {
  max-width: 1200px;
}

.md-popup.mode-image .md-popup-box,
.md-popup.mode-gallery .md-popup-box {
  width: 96%;
  max-width: 1600px;
  height: 92vh;
  max-height: 92vh;
  overflow: hidden;
  background: transparent;
  color: #ffffff;
}

.md-popup.mode-image .md-popup-body,
.md-popup.mode-gallery .md-popup-body {
  width: 100%;
  height: 100%;
}

.md-popup-close {
  position: fixed;
  z-index: 30005;
  top: 18px;
  right: 22px;
  width: 50px;
  height: 50px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--popup-close-line);
  border-radius: 50%;
  background: var(--popup-close-bg);
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.md-popup-close::before,
.md-popup-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 2px;
  background: var(--popup-close-icon);
}

.md-popup-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.md-popup-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.md-popup-close:hover {
  opacity: 0.75;
  transform: rotate(90deg);
}

.md-popup-body {
  width: 100%;
}

.md-popup-text-wrap {
  padding: 55px 55px 60px;
}

.md-popup-title {
  margin: 0 0 30px;
  font-size: 28px;
  font-weight: bold;
  line-height: 1.5;
  text-align: center;
}

.md-popup-text {
  font-size: 16px;
  line-height: 1.9;
}

.md-popup-text p {
  margin: 0 0 18px;
}

.md-popup-text p:last-child {
  margin-bottom: 0;
}

.md-popup-text img {
  max-width: 100%;
  height: auto;
  border: 0;
}

.md-popup-single {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 20px 65px;
  overflow: hidden;
}

.md-popup-single-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100% - 38px);
  margin: 0 auto;
  border: 0;
  object-fit: contain;
}

.md-popup-caption {
  flex-shrink: 0;
  margin-top: 10px;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.md-popup-caption:empty {
  display: none;
}

.md-popup-gallery-view {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.md-popup-gallery-main {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 15px 65px;
  overflow: hidden;
}

.md-popup-gallery-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  border: 0;
  object-fit: contain;
}

.md-popup-prev,
.md-popup-next {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 50px;
  height: 70px;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--popup-arrow-bg);
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    background 0.25s ease,
    opacity 0.25s ease;
}

.md-popup-prev {
  left: 0;
}

.md-popup-next {
  right: 0;
}

.md-popup-prev:hover,
.md-popup-next:hover {
  background: var(--popup-arrow-bg-hover);
}

.md-popup-prev::before,
.md-popup-next::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 15px;
  border-top: 3px solid var(--popup-arrow-color);
  border-right: 3px solid var(--popup-arrow-color);
}

.md-popup-prev::before {
  transform: translate(-35%, -50%) rotate(-135deg);
}

.md-popup-next::before {
  transform: translate(-65%, -50%) rotate(45deg);
}

.md-popup-gallery-info {
  flex-shrink: 0;
  min-height: 24px;
  padding: 5px 0 3px;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.md-popup-thumbs {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 7px 0 2px;
  overflow-x: auto;
  overflow-y: hidden;
}

.md-popup-thumb {
  flex: 0 0 auto;
  width: 86px;
  height: 60px;
  margin: 0;
  padding: 3px;
  overflow: hidden;
  border: 2px solid transparent;
  background: transparent;
  opacity: 0.55;
  cursor: pointer;
  transition:
    opacity 0.25s ease,
    border-color 0.25s ease;
}

.md-popup-thumb:hover {
  opacity: 1;
}

.md-popup-thumb.is-active {
  opacity: 1;
  border-color: var(--popup-thumb-line);
}

.md-popup-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.md-popup-youtube-wrap {
  padding: 50px;
}

.md-popup-youtube-title {
  margin: 0 0 30px;
  color: var(--popup-text);
  font-size: 28px;
  font-weight: bold;
  line-height: 1.5;
  text-align: center;
}

.md-popup-youtube {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  overflow: hidden;
  background: #000000;
}

.md-popup-youtube iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

html.md-popup-opened,
body.md-popup-opened {
  overflow: hidden;
}

@media screen and (max-width: 768px) {

  .md-popup {
    height: 100vh;
    height: 100dvh;
  }

  .md-popup-box,
  .md-popup-box.popup-small,
  .md-popup-box.popup-normal,
  .md-popup-box.popup-wide {
    width: 90%;
    max-width: none;
    max-height: 88vh;
    max-height: 88dvh;
  }

  .md-popup.mode-image .md-popup-box,
  .md-popup.mode-gallery .md-popup-box {
    width: 96%;
    height: 94vh;
    height: 94dvh;
    max-height: 94vh;
    max-height: 94dvh;
  }

  .md-popup-close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
  }

  .md-popup-close::before,
  .md-popup-close::after {
    width: 19px;
  }

  .md-popup-text-wrap {
    padding: 45px 6% 45px;
  }

  .md-popup-title {
    margin-bottom: 25px;
    font-size: 22px;
  }

  .md-popup-text {
    font-size: 15px;
    line-height: 1.8;
  }

  .md-popup-single {
    padding: 58px 3% 14px;
  }

  .md-popup-single-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100% - 34px);
    object-fit: contain;
  }

  .md-popup-caption {
    margin-top: 7px;
    font-size: 12px;
  }

  .md-popup-gallery-main {
    padding: 58px 42px 4px;
  }

  .md-popup-gallery-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .md-popup-prev,
  .md-popup-next {
    width: 38px;
    height: 56px;
  }

  .md-popup-prev::before,
  .md-popup-next::before {
    width: 12px;
    height: 12px;
    border-top-width: 2px;
    border-right-width: 2px;
  }

  .md-popup-gallery-info {
    min-height: 21px;
    padding: 4px 0 2px;
    font-size: 12px;
  }

  .md-popup-thumbs {
    justify-content: flex-start;
    gap: 6px;
    padding-top: 5px;
  }

  .md-popup-thumb {
    width: 64px;
    height: 46px;
  }

  .md-popup-youtube-wrap {
    padding: 45px 5% 40px;
  }

  .md-popup-youtube-title {
    margin-bottom: 25px;
    font-size: 22px;
  }

}
