@charset "utf-8";

/*
 * トップページ FV: 雫→地球→キャラクター 登場アニメーション
 * 仕様: assets/images/index/animation-spec.md
 * サンプル: /sample.html にて調整済みの内容を反映
 * ※ トップページ(front-page.php)のみ読み込む。functions.php の add_files() で
 *   is_front_page() の時だけ wp_enqueue_style() している。
 */

/* ===== FVステージ全体 =====
   .layout-fv : 常に幅いっぱい。背景グラデーションはここで持つ。
   .inner     : アニメーション本体を入れる箱。
     通常は幅いっぱいだが、横に広く縦が低い画面(ワイドモニターなど)では、
     幅基準のままだと縦(aspect-ratio分の高さ)が画面の高さを超えてスクロールしないと
     地球の下まで見えなくなるため、画面の高さに収まる幅へ自動的に縮小し、
     左右中央寄せにする。.layout-fvはflexで.innerを中央寄せしつつ、
     高さは.innerに合わせて自動で決まる。
     .layout-screenがヘッダー分の高さ(var(--header-height))をpadding-topで
     確保しているため、実際にFVが表示できる高さは 100vh - ヘッダーの高さ となる。
     ヘッダーの高さはブレークポイントごとに変わる(layout.cssの.layout-headerと同じ値)ため、
     ここでも同じブレークポイントで対応する変数に切り替える。 */
.layout-fv{
  position: relative; /* .fv-char.-edge をブラウザ幅基準で配置するための基準 */
  display: flex;
  justify-content: center;
  width: 100%;
  overflow: hidden; /* 画面(ビューポート)の外にはみ出さないよう、ここで最終的に切る */
  background: linear-gradient(180deg, #eaf6fb 0%,  #cfe9f6 100%);
  position: fixed;
}
.layout-fv .inner{
  position: relative;
  overflow: visible; /* 地球の外側(左右)にキャラクターがはみ出せるように */
}
.layout-kvdummy,
.layout-fv .inner{
  /*width: min(100%, calc((100vh - var(--header-height)) * 1080 / 960));*/
  width: min(100%, calc((100vh - var(--header-height)) * 880 / 960));
  aspect-ratio: 1180 / 960;
  /*aspect-ratio: 1080 / 960;*/
}

/* 地球+周辺の人(base.png) : 幅いっぱい、底が見えるように配置
   ※ painter/idea/jumperが登場した後に、地球と残りの人(edge/laptop)が登場する順番にしている */
.fv-globe{
  position: absolute;
  bottom: 0px;
  left: 0;
  width: 100%;
  height: auto;
  opacity: 0;
  transform-origin: 50% 40%;
  transform: scale(0.3);
  animation: fvSpringIn 2s forwards;
  animation-delay: 2.4s;
}

/* 雫(sizuku.png) : 上から落下してくる */
.fv-drop{
  position: absolute;
  left: 50.1%;
  top: -8%;
  width: 2.6%;
  height: auto;
  transform: translateX(-50%) rotate(0deg);
  animation: fvDropFall 1.05s cubic-bezier(.55,0,.85,.35) forwards;
}
@keyframes fvDropFall{
  0%   { top: -8%; opacity: 1; transform: translateX(-50%) scale(1); }
  88%  { top: 68%;   opacity: 1; transform: translateX(-50%) scale(1); }
  100% { top: 73.5%; opacity: 0; transform: translateX(-50%) scaleX(1.7) scaleY(0.35); }
}

/* 波紋: 着地と同時に、3つ連続で広がってフェード(石を落としたときの波紋のイメージ) */
.fv-ripple{
  position: absolute;
  left: 50.1%;
  top: 73.5%;
  width: 2%;
  height: 2%;
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: fvRipple 1s ease-out forwards;
  animation-delay: 0.9s;
}
.fv-ripple.-r2{
  animation-delay: 1.05s;
}
.fv-ripple.-r3{
  animation-delay: 1.2s;
}
@keyframes fvRipple{
  0%   { width: 2%;  height: 2%;  opacity: .8; }
  100% { width: 56%; height: 26%; opacity: 0; }
}

/* 地球本体のバネの減衰振動(スケールイン) */
@keyframes fvSpringIn{
  0%   { opacity: 0; transform: scale(0.3);  animation-timing-function: cubic-bezier(.2,.8,.3,1); }
  18%  { opacity: 1; transform: scale(1.12); animation-timing-function: cubic-bezier(.4,0,.6,1); }
  34%  { transform: scale(0.96); animation-timing-function: cubic-bezier(.4,0,.6,1); }
  50%  { transform: scale(1.05); animation-timing-function: cubic-bezier(.4,0,.6,1); }
  64%  { transform: scale(0.98); animation-timing-function: cubic-bezier(.4,0,.6,1); }
  80%  { transform: scale(1.02); animation-timing-function: cubic-bezier(.4,0,.6,1); }
  100% { opacity: 1; transform: scale(1); }
}

/* ===== 外から飛んでくるキャラクター(01/02/03.png) ===== */
.fv-char{
  position: absolute;
  height: auto;
  opacity: 0;
  animation: fvFlyIn 2s forwards;
  display: block;
}

/* ===== 登場順: ①painter→idea→jumper　②地球　③edge→laptop ===== */

/* 03.png(ペンキ屋さん) : 上中央から飛び込んでくる。①のグループの3番目。登場後は常に少しだけ揺れ続ける */
.fv-char.-jumper{
  left: 40%;
  top: 6%;
  width: 28%;
  --fx: 0%;
  --fy: -55%;
  animation: fvFlyIn 2s forwards 2.0s, fvIdleFloat 3.4s ease-in-out infinite 4.0s;
}
/* 01.png(ジャンプしているキャラ) : 左上から飛び込んでくる。地球の外側(左)にはみ出す位置に配置。①のグループの1番目。登場後は常に少しだけ揺れ続ける */
.fv-char.-painter{
  left: -5%;
  top: 10%;
  width: 30%;
  --fx: -60%;
  --fy: -45%;
  animation: fvFlyIn 2s forwards 1.6s, fvIdleFloat 3.5s ease-in-out infinite 3.6s;
}
/* 02.png : 右側から飛び込んでくる(ひらめきの人)。地球の外側(右)にはみ出す位置に配置。①のグループの2番目。登場後は常に少しだけ揺れ続ける */
.fv-char.-idea{
  left: 75%;
  top: 12%;
  width: 25%;
  --fx: 60%;
  --fy: -35%;
  animation: fvFlyIn 2s forwards 1.8s, fvIdleFloat 3.6s ease-in-out infinite 3.8s;
}
/* 04.png : ブラウザの一番左端に配置。スマホ幅では画面端で切れてもよい
   ※ left/topは中心基準(translate(-50%,-50%))のため、0%だと幅の半分が
   画面外に切れてしまう。全身が見えるよう width の半分をleftに指定する。
   ③のグループ(地球のあとに登場する残りの人)の1番目。 */
.fv-char.-edge{
  left: -20%;
  top: 59%;
  width: 15%;
  --fx: -60%;
  --fy: 20%;
  animation-delay: 2.8s;
}
/* 05.png : 右側、ひらめきの人(-idea)の下あたりから飛び込んでくる(ノートPCを持つ人)。③のグループの2番目。 */
.fv-char.-laptop{
  right: -8%;
  top: 55%;
  width: 12%;
  --fx: 55%;
  --fy: -20%;
  animation-delay: 3.0s;
}

/* スマホ幅程度になると.innerが画面幅いっぱいになり、はみ出す余白がなくなって
   左右のキャラクターが画面端で切れてしまうため、内側に寄せる(-edgeは切れてもよいので対象外) */
@media (max-width: 930px){
  .fv-char.jumper{
    width: 32%;
  }
  .fv-char.-painter{
    left: 4%;
    top:5%;
    width: 30%;
  }
  .fv-char.-idea{
    left: 72%;
    width: 24%;
  }
  .fv-char.-laptop{
    right:3%;
    width:8%;
  }
  .fv-char.-edge{
    display: none;
  }
}

/* 軽いキャラクターは振れ幅を大きく、収束を速く
   ※ translateによる位置移動はなし。left/top(またはright/top)の位置で
   固定したまま、scaleとrotateだけでバネのように登場する。 */
@keyframes fvFlyIn{
  0%   { opacity: 0; transform: scale(0.4) rotate(-8deg); animation-timing-function: cubic-bezier(.2,.8,.3,1); }
  16%  { opacity: 1; transform: scale(1.32) rotate(4deg); animation-timing-function: cubic-bezier(.4,0,.6,1); }
  32%  { transform: scale(0.82) rotate(-2deg); animation-timing-function: cubic-bezier(.4,0,.6,1); }
  48%  { transform: scale(1.14) rotate(1deg); animation-timing-function: cubic-bezier(.4,0,.6,1); }
  64%  { transform: scale(0.94); animation-timing-function: cubic-bezier(.4,0,.6,1); }
  80%  { transform: scale(1.05); animation-timing-function: cubic-bezier(.4,0,.6,1); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* 登場後、絶えず少しだけ揺れ続ける(jumper/idea/edgeのみ)
   ※ transformではなくtranslateプロパティを使うことで、fvFlyInのtransform(scale/rotate)と
   競合せず同時に効かせられる。 */
@keyframes fvIdleFloat{
  0%   { translate: 0 0; }
  50%  { translate: 0 -16px; }
  100% { translate: 0 0; }
}

/* ===== 吹き出し(ツールチップ) =====
   表示されるのは常に1つだけ。JS(assets/js/event.js)が
   ・テキストをローテーション(3つから増減してもOK)
   ・表示位置をランダム(ただし上が見切れない範囲)に決めて
   left/top を書き換え、is-visible / is-hiding クラスの付け替えで
   「消えては現れる」を繰り返す。緑背景/白文字。
   しっぽの形状はCSSマスクで表現(--p でしっぽの左右位置を調整)。 */
.fv-tooltip{
  position: absolute;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(0.85);
}
.fv-tooltip.is-visible{
  animation: fvTooltipShow 0.6s cubic-bezier(.34,1.56,.64,1) forwards;
}
.fv-tooltip.is-hiding{
  animation: fvTooltipHide 0.35s ease forwards;
}
@keyframes fvTooltipShow{
  0%   { opacity: 0; transform: translateY(24px) scale(0.85); }
  60%  { opacity: 1; transform: translateY(-5px) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fvTooltipHide{
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(16px) scale(0.9); }
}

.fv-tooltip .tooltip{
  /* --bubble-bg / --bubble-color はJS(event.js)がテキストごとに書き換える。
     未指定の場合のフォールバックはこれまでと同じ配色。 */
  color: var(--bubble-color, #fff);
  font-size: 16px;
  font-weight: bold;
  line-height: 1.7;
  max-width: 30ch;
  text-align: center;
  --p: 50%;      /* しっぽの位置(0%:左 100%:右、中央=50%) */
  --tw: 0.85em;  /* しっぽの半幅 */
  --th: 0.95em;  /* しっぽの高さ */
  --r: 1em;      /* 角丸 */
  --bw: 3px;     /* ボーダーの太さ */
  padding: 1.1em 1.4em;
  border-radius: var(--r);
  background: var(--bubble-bg, var(--color-link));
  border: var(--bw) solid #fff;
  position: relative;
  letter-spacing: 0.1em;
}
/* しっぽ: border三角形の定番テクニックで、白(外側・大きめ)の三角の上に
   本体色(内側・少し小さめ)の三角を重ねることで、縁取り付きの尖った三角形にする */
.fv-tooltip .tooltip:before,
.fv-tooltip .tooltip:after{
  content: "";
  position: absolute;
  left: var(--p);
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left-style: solid;
  border-right-style: solid;
  border-top-style: solid;
  border-left-color: transparent;
  border-right-color: transparent;
}
.fv-tooltip .tooltip:before{
  top: 100%;
  border-left-width: calc(var(--tw) + var(--bw));
  border-right-width: calc(var(--tw) + var(--bw));
  border-top-width: calc(var(--th) + var(--bw));
  border-top-color: #fff;
}
.fv-tooltip .tooltip:after{
  top: calc(100% - var(--bw));
  border-left-width: var(--tw);
  border-right-width: var(--tw);
  border-top-width: var(--th);
  border-top-color: var(--bubble-bg, var(--color-link));
}

@media (max-width: 930px){
  .fv-tooltip .tooltip{
    font-size: 1.2rem;
    max-width: 14ch;
    padding: 0.7em 1em;
  }
}

.layout-kvdummy{

}
.layout-main{
  position: relative;
  z-index: 2;
  background: white;
}

.layout-section{
  padding:20px 0
}


.layout-main{
  .heading-page{
    color:var(--main-color);
  }
  .heading-shizuku{
    background-image: url('/c/wp-content/themes/ani-connect/assets/images/index/fv/sizuku.png');
    background-repeat: no-repeat;
    background-position: left center;
    background-size: auto 1.2em;
    padding-left: 1.5em;
  }
  .layout-section{
    padding: 20px 0;
    &.-type{
      padding-top:60px;
      position: relative;
      background: #e3f3fa;
      background: linear-gradient( to bottom, #f9f5eb 0%,  #ffffff 100% );
      border-radius: 60px 60px 0 0;
      @media (max-width: 840px){
        border-radius: 80px 80px 0 0;
      }
      @media (max-width: 500px){
        border-radius: 30px 30px 0 0;
      }
      .grid-block.-type{
        gap:50px;
        @media (max-width: 500px){
          gap:0px;
        }
        > *{
          
          @media (max-width: 500px){
            /*border:1px solid #ccc;
            background: white;*/
            padding:20px;
            border-radius: 12px;
          }
          img{
            max-width:240px;
            width: 80%;
            margin:0 auto;
            aspect-ratio: 4 / 3;
            object-fit: contain;
            @media (max-width: 500px){
              max-width:200px;
            }
          }
          p.eng{
            text-align: center;
            font-family: sans-serif;
            font-weight: bold;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            font-size: 90%;
            opacity: 0.65;
            margin: 6px 0 0;
          }
          &.-art{
            dt{
              color:#e95098;
            }
          }
          &.-science{
            dt{
              color:#f0831e;
            }
          }
          &.-global{
            dt{
              color:#44bcbc;
            }
          }

          dl{
            dt{
              font-size:130%;
              font-weight: bold;
              font-family: "Zen Maru Gothic", sans-serif;
              line-height: 1.7;
              margin:0 0 0.4em 0;
            }
          }
        }
      }
    }
    &.-schedule{
      padding-top:0;
    }
  }
  .grid-block.-intro{
    .summary{
      p:last-child{
        margin-bottom:0;
      }
    }
    .view{
      .image{
        margin:0 0 20px 0;
        img{
          display: block;
          width:100%;
        }
      }
    }
  }
  /* スケジュールは アニメ講習会→ワークショップ→交流会→ショーケース の順に進むため、
     カードの間に矢印を入れて「次へ次へ」の流れがわかるようにする */
  .grid-block.-flow{
    position: relative;
    > .card-schedule{
      /*.free{
        position: absolute;
        top:0;
        right:0;
        transform: translateY(-100%);
        padding: 4px 22px;
        border-radius: 20px 20px 0 0;
        font-weight: bold;
      }*/
    }
    > .card-schedule:not(:last-child){
      &:after{
        content: "";
        position: absolute;
        top: 50%;
        right: -22px;
        width: 14px;
        height: 14px;
        border-top: 3px solid var(--color-text);
        border-right: 3px solid var(--color-text);
        transform: translateY(-50%) rotate(45deg);
        z-index: 2;
      }
    }
    @media (max-width: 840px){
      /* 2列になったら、行の右端(2番目)には矢印を出さない。代わりに折り返し先頭(3番目)の上に下向き矢印を出す */
      > .card-schedule:nth-child(2):after{

      }
      > .card-schedule:nth-child(3):before{
        content: "";
        position: absolute;
        top: -22px;
        left: 50%;
        width: 14px;
        height: 14px;
        border-top: 3px solid var(--color-orange);
        border-right: 3px solid var(--color-orange);
        transform: translateX(-50%) rotate(135deg);
        z-index: 2;
      }
    }
    @media (max-width: 500px){
      /* 1列になったら、すべて下向き矢印にする */
      > .card-schedule:not(:last-child):after{
        top: auto;
        right: auto;
        left: 50%;
        bottom: -22px;
        transform: translateX(-50%) rotate(135deg);
      }
      > .card-schedule:nth-child(3):before{
        display: none;
      }
    }
  }
  /* スケジュール一覧の「概要」など、常に1列縦並びで表示したい場合用のモディファイア。
     幅に関係なく1列固定にし、矢印も常に下向きにする */
  .grid-block.-vertical{
    grid-template-columns: repeat(1, 1fr) !important;
    gap: 60px;
  }
  .grid-block.-vertical.-flow{
    > .card-schedule:nth-child(3):before{
      display: none;
    }
    > .card-schedule:not(:last-child):after{
      top: auto;
      right: auto;
      left: 50%;
      bottom: -37px;
      transform: translateX(-50%) rotate(135deg);
    }
  }
  .grid-block.-vertical .card-schedule .copy{
    font-size:190%;
    @media (max-width: 840px){
      font-size:150%;
    }
    @media (max-width: 500px){
      font-size:120%;
    }
    br{
      display: none;
    }
  }
  .card-schedule{
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 20px 20px;
    border-radius: 0px;
    background: #fff;
    color:var(--color-text);
    transition: box-shadow .2s ease, transform .2s ease;
    line-height: 1.5;
    &:hover{
      box-shadow: 0 4px 12px rgba(0,0,0,.08);
      transform: translateY(-2px);
    }
    &.-pre{
      background-color:var(--color-yellow);
    }
    &.-workshop{
      background-color:var(--color-orange);
      color:white;
      .btn{
        opacity: 0.4;
      }
      pointer-events: none;
    }
    &.-meeting{
      background-color:var(--color-orange);
      color:white;
      .btn{
        opacity: 0.4;
      }
      pointer-events: none;
    }
    &.-show{
      background-color:var(--color-bluegreen);
      color:white;
      .btn{
        opacity: 0.4;
      }
      pointer-events: none;
    }
    nav{
      margin-top:auto;
      margin-bottom:10px;
      text-align: center;
      padding:18px 0 0 0;
      .btn{
        color:white;
        background-color: rgba(0, 0,0, 0.3);
        border-radius: 30px;
        padding: 8px 18px;
      }
    }
    .title{
      margin: 0 0 0.6em 0;
      font-family: "Zen Maru Gothic", sans-serif;
      font-weight: bold;
      font-size: 105%;
      .inner{
        background: white;
         padding:4px 4px;
        border-radius: 4px;
        color:var(--color-text);
      }
    }
    .copy{
      margin:15px 0 0.6em 0;
      display: block;
      font-family: "Zen Maru Gothic", sans-serif;
      font-size:120%;
      font-weight: bold;
      br{
        @media (max-width: 500px){
          display: none;
        }
      }
    }
    .date{
      margin: 0 0 0.4em 0;
      line-height: 1.6;
      font-weight: bold;
    }
    .free{
      display: inline-block;
      margin: 0 0 0.4em 0;
      font-size: 85%;
      font-weight: bold;
      background: rgba(255,255,255,0.65);
      border-radius: 20px;
      padding: 2px 12px;
    }
    .note{
      margin: 0 0 0.6em 0;
      font-size: 90%;
      line-height: 1.5;
    }
  }
  /* 参加概要・お問い合わせ: dd/td内の箇条書きの余白調整 */
  .layout-section{
    dd,
    td{
      ol.list-decimal,
      ul.list-disc{
        margin: 6px 0 0 1.2em;
        li{
          margin-bottom: 0.3em;
        }
      }
    }
  }
  /* 参加概要: テーブル表示 */
  .table-line.-overview{
    width: 100%;
    th{
      width: 180px;
      vertical-align: top;
      font-weight: bold;
    }
    td{
      vertical-align: top;
    }
    @media (max-width: 500px){
      th, td{
        display: block;
        width: auto;
      }
      th{
        padding-bottom: 0;
        border:none;
      }
      td{
        padding-top:0;
      }
      tr{
        display: block;
        margin-bottom: 10px;
      }
    }
  }
}