/**
 * DG Mobile Menu
 * mobilemenu.css
 *
 * 1024px以下で有効
 *
 * JavaScriptとの役割分担：
 * ・#wrapperのposition、top、left、高さはJavaScriptが設定
 * ・縮小、横移動、影、アニメーションはCSSが設定
 * ・html/bodyのpositionやoverflowは変更しない
 */


/* ==================================================
   通常時
================================================== */

.dgmm {
  display: none;
}


/* ==================================================
   タブレット・モバイル
================================================== */

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

  :root {
    --dgmm-duration: 450ms;
    --dgmm-easing: cubic-bezier(0.76, 0, 0.24, 1);

    --dgmm-menu-width: 30vw;
    --dgmm-menu-color: #fff;

    --dgmm-shift-x: 30vw;
    --dgmm-scale: 0.9;
    --dgmm-origin-y: 50vh;
  }


  /* ==================================================
     メニュー全体
  ================================================== */

  .dgmm {
    display: block;
  }


  /*
   * メニュー背景
   */
  .dgmm::before {
    content: "";
    position: fixed;
    z-index: 18500;
    inset: 0;

    background:
      linear-gradient(
        0deg,
        #cf0033 0%,
        #75001d 100%
      );

    visibility: hidden;
    opacity: 0;
    pointer-events: none;

    transition:
      opacity var(--dgmm-duration) ease,
      visibility 0s linear var(--dgmm-duration);
  }


  body.dgmm-open .dgmm::before {
    visibility: visible;
    opacity: 1;
    pointer-events: none;

    transition:
      opacity var(--dgmm-duration) ease,
      visibility 0s linear 0s;
  }


  /* ==================================================
     メニュー本体
  ================================================== */

  .dgmm-menu {
    position: fixed;
    z-index: 18520;

    top: 0;
    bottom: 0;
    left: 0;

    box-sizing: border-box;

    width: var(--dgmm-menu-width);
    height: 100vh;
    height: 100dvh;

    padding-top:
      max(
        150px,
        calc(env(safe-area-inset-top) + 80px)
      );

    padding-right: 24px;

    padding-bottom:
      max(
        30px,
        env(safe-area-inset-bottom)
      );

    padding-left:
      max(
        30px,
        env(safe-area-inset-left)
      );

    color: var(--dgmm-menu-color);

    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;

    visibility: hidden;
    opacity: 0;
    pointer-events: none;

    transition:
      opacity 350ms ease,
      visibility 0s linear var(--dgmm-duration);
  }


  body.dgmm-open .dgmm-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;

    transition:
      opacity 400ms ease 80ms,
      visibility 0s linear 0s;
  }


  .dgmm-menu__inner {
    display: flex;
    flex-direction: column;

    box-sizing: border-box;

    width: 100%;
    min-height: 100%;
  }


  /* ==================================================
     メニューリスト
  ================================================== */

  .dgmm-menu__list {
    display: flex;
    flex-direction: column;

    gap: clamp(26px, 5vh, 44px);

    margin: 0;
    padding: 0;

    list-style: none;
  }


  .dgmm-menu__list li {
    margin: 0;
    padding: 0;
  }


  .dgmm-menu__list a {
    display: block;

    box-sizing: border-box;

    width: 100%;

    color: var(--dgmm-menu-color);

    font-size: clamp(14px, 1.5vw, 16px);
    font-weight: 400;
    line-height: 1.4;

    text-decoration: none;
    white-space: nowrap;

    background-image:
      url("../img/header/ic-ar_h_w.webp");

    background-repeat: no-repeat;
    background-position: 98% center;
    background-size: auto 12px;

    transition:
      background-position 400ms ease,
      opacity 300ms ease;
  }


  .dgmm-menu__list a:hover {
    background-position: 100% center;
  }


  .dgmm-menu__list a:active {
    opacity: 0.65;
  }


  /* ==================================================
     SNSリンク
  ================================================== */

  .dgmm-menu__sns {
    display: flex;
    flex-wrap: wrap;

    gap: 14px;

    margin: auto 0 0;
    padding: 30px 0 0;

    list-style: none;
  }


  .dgmm-menu__sns li {
    margin: 0;
    padding: 0;
  }


  .dgmm-menu__sns li a {
    display: block;

    width: 30px;
    height: 30px;

    overflow: hidden;

    text-indent: -9999px;

    background-repeat: no-repeat;
    background-position: center;
    background-size: 25px;
  }


  /* ==================================================
     通常時のwrapper
  ================================================== */

  #wrapper {
    position: relative;
    z-index: 1;

    width: 100%;

    min-height: 100vh;
    min-height: 100dvh;

    transform: none;
    transform-origin: left top;

    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }


  /* ==================================================
     ページ高さ維持用スペーサー
  ================================================== */

  /*
   * JavaScriptが生成する要素：
   *
   * <div class="dgmm-spacer"></div>
   *
   * 高さはJavaScriptがインラインで設定します。
   */
  .dgmm-spacer {
    display: block;

    width: 100%;

    margin: 0;
    padding: 0;
    border: 0;

    visibility: hidden;
    pointer-events: none;
  }


  /* ==================================================
     wrapperのアニメーション準備
  ================================================== */

  /*
   * position:fixed、top、left、widthなどは、
   * JavaScriptがインラインで設定します。
   */
  body.dgmm-preparing #wrapper,
  body.dgmm-open #wrapper,
  body.dgmm-closing #wrapper {
    z-index: 20010;

    transform-origin:
      left var(--dgmm-origin-y);

    transition:
      transform
      var(--dgmm-duration)
      var(--dgmm-easing),

      box-shadow
      var(--dgmm-duration)
      var(--dgmm-easing);

    will-change: transform;
  }


  /*
   * 開く直前の状態
   */
  body.dgmm-preparing #wrapper {
    transform:
      translate3d(0, 0, 0)
      scale(1);

    box-shadow: none;
  }


  /*
   * メニュー展開状態
   */
  body.dgmm-open #wrapper {
    transform:
      translate3d(
        var(--dgmm-shift-x),
        0,
        0
      )
      scale(var(--dgmm-scale));

    box-shadow:
      -15px 0 40px
      rgb(0 0 0 / 18%);

    cursor: pointer;

    /*
     * wrapperのタップで閉じるため、
     * pointer-events:noneは設定しません。
     */
    pointer-events: auto;

    touch-action: none;

    user-select: none;
    -webkit-user-select: none;
  }


  /*
   * 閉じるアニメーション
   */
  body.dgmm-closing #wrapper {
    transform:
      translate3d(0, 0, 0)
      scale(1);

    box-shadow: none;

    pointer-events: auto;
  }


  /* ==================================================
     開閉ボタン
  ================================================== */

  .dgmm-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    position: fixed;
    z-index: 19000;

    top:
      max(
        18px,
        env(safe-area-inset-top)
      );

    left:
      calc(
        100% -
        52px -
        16px -
        env(safe-area-inset-right)
      );

    width: 52px;
    height: 58px;

    margin: 0;
    padding: 0;

    border: 0;
    border-radius: 0;
    outline: 0;

    color: #000;
    background: var(--color-white);

    appearance: none;
    -webkit-appearance: none;

    cursor: pointer;

    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;

    transition:
      left
      var(--dgmm-duration)
      var(--dgmm-easing),

      color
      350ms
      ease;
  }


  body.dgmm-open .dgmm-button {
    left:
      max(
        5%,
        env(safe-area-inset-left)
      );

    color: #fff;
    background: transparent;
  }


  /* ==================================================
     ハンバーガーアイコン
  ================================================== */

  .dgmm-button__icon {
    display: block;
    position: relative;

    width: 44px;
    height: 30px;
  }


  .dgmm-button__icon > span {
    display: block;
    position: absolute;

    left: 0;

    width: 100%;
    height: 2px;

    background: currentColor;

    transform-origin: center;

    transition:
      top 400ms var(--dgmm-easing),
      transform 400ms var(--dgmm-easing),
      opacity 200ms ease;
  }


  .dgmm-button__icon > span:nth-child(1) {
    top: 4px;
  }


  .dgmm-button__icon > span:nth-child(2) {
    top: 14px;
  }


  .dgmm-button__icon > span:nth-child(3) {
    top: 24px;
  }


  body.dgmm-open
  .dgmm-button__icon
  > span:nth-child(1) {
    top: 13px;
    transform: rotate(45deg);
  }


  body.dgmm-open
  .dgmm-button__icon
  > span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }


  body.dgmm-open
  .dgmm-button__icon
  > span:nth-child(3) {
    top: 13px;
    transform: rotate(-45deg);
  }


  /* ==================================================
     MENU / CLOSEテキスト
  ================================================== */

  .dgmm-button__text,
  .dgmm-button-text {
    display: block;

    margin-top: 5px;

    font-family:
      var(--font-en, sans-serif);

    font-size: 12px;
    font-weight: 500;
    line-height: 1;
  }
}


/* ==================================================
   スマートフォン
================================================== */

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

  :root {
    --dgmm-menu-width: 50vw;
    --dgmm-shift-x: 50vw;
    --dgmm-scale: 0.8;
  }


  .dgmm-menu {
    padding-right: 18px;

    padding-left:
      max(
        24px,
        env(safe-area-inset-left)
      );
  }


  .dgmm-menu__list {
    gap: 26px;
  }


  .dgmm-menu__list a {
    font-size:
      clamp(
        14px,
        3.8vw,
        16px
      );
  }
}


/* ==================================================
   小型スマートフォン
================================================== */

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

  .dgmm-menu {
    padding-left:
      max(
        18px,
        env(safe-area-inset-left)
      );
  }


  .dgmm-menu__list a {
    font-size: 16px;
  }


  .dgmm-menu__sns {
    gap: 8px;
  }


  .dgmm-menu__sns li a {
    width: 31px;
    height: 31px;
  }
}


/* ==================================================
   PC
================================================== */

@media screen and (min-width: 1025px) {

  .dgmm,
  .dgmm-menu,
  .dgmm-button,
  .dgmm-spacer {
    display: none !important;
  }


  #wrapper {
    position: relative !important;

    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;

    width: 100% !important;

    transform: none !important;
    transform-origin: left top !important;

    box-shadow: none !important;

    cursor: auto !important;

    pointer-events: auto !important;
    touch-action: pan-y !important;

    user-select: auto !important;
    -webkit-user-select: auto !important;

    will-change: auto !important;
  }
}


/* ==================================================
   動きを減らす設定
================================================== */

@media screen and
(max-width: 1024px) and
(prefers-reduced-motion: reduce) {

  .dgmm::before,
  .dgmm-menu,
  .dgmm-button,
  .dgmm-button__icon > span,
  #wrapper {
    transition-duration: 1ms !important;
    transition-delay: 0s !important;
  }
}