/*! Lity Vanilla Lite - based on Lity v2.4.1 - 2026-07-28
 * Original project: http://sorgalla.com/lity/
 * Original copyright (c) 2015-2020 Jan Sorgalla; Licensed MIT
 * Optimized build: CSS-first layout, manual tunables in :root, removed layout extension API hooks.
 * v1.2: 開閉アニメーション用に -webkit- プレフィックス / will-change を追加。
 *
 */

:root {
  /* ────── レイアウト：上下左右の余白 (margin 省略記述) ───── */
  --lity-margin: 3%; /* 35px 20px */
  --lity-margin-video: 0 2%;
  /* --lity-margin-block: 50px;   /* --lity-marginの上下を足した数値を記述 */

  /* ────── 最大幅 ────────────────────────── */
  --lity-max-width: 900px;     /* iframe/Youtube/Vimeo の最大幅 */

  /* ────── 角丸・背景 ──────────────────────── */
  --lity-radius: 8px;
  --lity-overlay: rgba(0, 0, 0, 0.4);

  /* ────── 閉じる×ボタン ────────────────────── */
  --lity-close-top: 4px;
  --lity-close-right: 4px;
  /* × の線 */
  --lity-close-color: #fff;
  --lity-close-size: 14px;
  --lity-close-width: 3px;
  --lity-close-radius: 100vh;
  --lity-close-shadow: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
  /* 背景 */
  --lity-close-bg-size: 32px;
  --lity-close-bg-color: rgba(0, 0, 0, 0.3);
  --lity-close-bg-radius: 50%;

  /* ────── iframe ローディングスピナー ─────────── */
  --lity-spinner-size: 46px;
  --lity-spinner-color: #fff;
  --lity-spinner-thickness: 3px;
  --lity-spinner-speed: 0.8s;
  
  /* ────── 表示順 ─────────── */
  --lity-wrap-z-index:9999;
}

/* ==========================================================================
   ベース構造
   ========================================================================== */
.lity,
.lity-wrap {
  position: fixed;
  inset: 0;
  outline: none !important;
}

.lity {
  z-index: var(--lity-wrap-z-index);
  white-space: nowrap;
  background: var(--lity-overlay);
  opacity: 0;
  -webkit-transition: opacity 0.3s ease;
  transition: opacity 0.3s ease;
}
.lity.lity-opened { opacity: 1; }
.lity.lity-closed { opacity: 0; }

/* ==========================================================================
    背景スクロールの固定：iOS Safari 対策あり
   ========================================================================== */
.lity {
  touch-action: none;
  overscroll-behavior: none;
}
html.lity-active {
  overflow: hidden;
}
.lity * {
  box-sizing: border-box;
}

.lity-wrap {
  display: flex;
  align-items: safe center;
  justify-content: center;
  padding: max(var(--lity-margin), calc(var(--lity-close-bg-size) / 2));
  overflow: auto;
  overscroll-behavior: contain; /* 端までスクロールした時の背景への連鎖を防止 */
}

/* ==========================================================================
   コンテナ / コンテンツ
   ========================================================================== */
.lity-container {
  z-index: calc(var(--lity-wrap-z-index) + 2);
  position: relative;
  text-align: left;
  vertical-align: middle;
  display: inline-block;
  white-space: normal;
  width: auto;
  max-width: 100%;
  max-height: 100%; /*calc(100vh - var(--lity-margin-block))*/
  margin: auto;
  outline: none !important;
}

.lity-content {
  z-index: calc(var(--lity-wrap-z-index) + 3);
  position: relative;
  width: auto;
  max-width: 100%;
  -webkit-transform: scale(1);
  transform: scale(1);
  -webkit-transition: -webkit-transform 0.3s ease;
  transition: transform 0.3s ease;
  will-change: transform; /* iOS Safari で合成レイヤー化してアニメーションを安定させる */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}
.lity-loading .lity-content,
.lity-closed .lity-content {
  -webkit-transform: scale(0.8);
  transform: scale(0.8);
}

.lity-content::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
}

/* ==========================================================================
   閉じる×ボタン
   ========================================================================== */
.lity-close {
  position: absolute;
  top: var(--lity-close-top);
  right: var(--lity-close-right);
  width: var(--lity-close-bg-size);
  height: var(--lity-close-bg-size);
  z-index: calc(var(--lity-wrap-z-index) + 4);
  background: var(--lity-close-bg-color);
  border-radius: var(--lity-close-bg-radius);
  cursor: pointer;
  /* 中央にCSSの×を配置 */
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(50%, -50%);
  /* 解除 */
  min-height:initial;
  padding: 0;
  border: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.lity-close::-moz-focus-inner {
  border: 0;
  padding: 0;
}
/* ==========================================================================
   CSSで「×」を描画
   ========================================================================== */
.lity-close-mark {
  position: relative;
  display: block;
  width: var(--lity-close-size);
  height: var(--lity-close-size);
  filter: var(--lity-close-shadow);
}
.lity-close-mark::before,
.lity-close-mark::after {
  content: '';
  position: absolute;
  width: 100%;
  height: var(--lity-close-width);
  left: 0;
  top: 50%;
  background: var(--lity-close-color);
  border-radius: var(--lity-close-radius);
}

/* 左上 → 右下 */
.lity-close-mark::before {
  transform: translateY(-50%) rotate(45deg);
}
/* 右上 → 左下 */
.lity-close-mark::after {
  transform: translateY(-50%) rotate(-45deg);
}
/* クリック時 */
.lity-close:active {
  top: var(--lity-close-top);
}
/* 動画 */
.lity-youtube .lity-close,
.lity-vimeo .lity-close {
  top:0;
  right:0;
  position: fixed;
  transform: none;
  background:none;
}
.lity-youtube .lity-wrap,
.lity-vimeo .lity-wrap{
  padding: var(--lity-margin-video);
}


/* ホバー */
@media (hover: hover) {
  .lity-close {
    transition:
      background-color 0.2s ease,
      transform 0.2s ease;
  }
  .lity-close:hover {
    background: rgba(0, 0, 0, 0.5);
  }
}


/* ==========================================================================
   ローダー本体
   ========================================================================== */
.lity-loader {
  z-index: calc(var(--lity-wrap-z-index) + 1);
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--lity-spinner-size);
  height: var(--lity-spinner-size);
  margin-top: calc(var(--lity-spinner-size) / -2);
  margin-left: calc(var(--lity-spinner-size) / -2);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.lity-loading .lity-loader {
  opacity: 1;
}

/* ==========================================================================
   iframe 用オーバーレイ
   ========================================================================== */
.lity-iframe-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  transition: opacity 0.12s linear;
}
.lity-iframe-spinner-visible .lity-iframe-spinner {
  opacity: 1;
}
.lity-iframe-loaded .lity-iframe-spinner {
  opacity: 0;
}

/* ==========================================================================
   共通の見た目
   ========================================================================== */
.lity-loader::before,
.lity-iframe-spinner::before {
  content: '';
  display: block;
  width: var(--lity-spinner-size);
  height: var(--lity-spinner-size);
  border-radius: 50%;
  border: var(--lity-spinner-thickness) solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--lity-spinner-color);
  box-sizing: border-box;
  animation: lity-iframe-spin var(--lity-spinner-speed) linear infinite;
}
@keyframes lity-iframe-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .lity-loader::before,
  .lity-iframe-spinner::before {
    animation-duration: 3s;
  }
}

/* ==========================================================================
   画像
   ========================================================================== */
.lity-image .lity-container {
  max-height: none;
}
.lity-image img {
  max-width: 100%;
  display: block;
  line-height: 0;
  border: 0;
}

/* ==========================================================================
   iframe / URL（汎用：縦100% 展開）
   ========================================================================== */
.lity-iframe .lity-container {
  width: 100%;
  max-width: var(--lity-max-width);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.lity-iframe .lity-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  max-height: none;
}

/* ==========================================================================
   YouTube / Vimeo（16:9 のアスペクト比を維持）
   ========================================================================== */
.lity-youtube .lity-container,
.lity-vimeo .lity-container {
  width: 100%;
  max-width: var(--lity-max-width);
  height: auto;
  margin: auto;
  aspect-ratio: 16 / 9;
  display: block;
}
.lity-youtube .lity-content,
.lity-vimeo .lity-content {
  width: 100%;
  height: 100%;
  flex: 0 0 auto;
  max-height: none;
}
.lity-youtube .lity-iframe-container,
.lity-vimeo .lity-iframe-container {
  flex: 0 0 auto;
}

/* ==========================================================================
   iframe-container は内側で 100% に広げる（URL / 動画 共通）
   ========================================================================== */
.lity-iframe-container {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  overflow: hidden;
  pointer-events: auto;
  transform: translateZ(0);
}
.lity-iframe-container iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}


/* ==========================================================================
   インライン / 角丸 / 非表示
   ========================================================================== */
.lity-inline .lity-wrap {
  overflow: hidden;
}
.lity-inline .lity-container {
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: var(--lity-max-width);
}

.lity-inline .lity-content {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain; /* 端までスクロールした時の背景への連鎖を防止 */
}

.lity-inline .lity-content > * {
  max-width: 100%;
}

.lity-content,
.lity-content::after,
.lity-content > *,
.lity-image img,
.lity-iframe-container,
.lity-iframe-container iframe {
  border-radius: var(--lity-radius);
}

.lity-hide { display: none; }
