/* =====================================================================
 * 動き（2026-11 に追加。JS は js/motion.js。stylus のビルドとは別に、直接書いている）
 * やわらかく、軽やかに（美容室のやさしい雰囲気に合わせて、大きくは動かさない）
 * - ページの切り替え：サイトの地の色の幕がふわっとかかり、中央に金の細い線が伸びて、次のページがほどける
 * - スクロールで出る：見出し・文章・カードが少し下から順に。写真は少し寄った状態から落ち着く
 * - ホバー：写真が枠の中でわずかに寄る、MORE の矢印が少し進む
 * - 動くものは transform・opacity だけ（ホバーの写真の寄りだけ clip-path を一緒に使う）
 * - 「動きを減らす」設定のときは何もしない（header.php で es-js を付けない）
 * ===================================================================== */

/* ---------------------------------------------------------------- ページの切り替えの幕 */
#es-veil {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #f8f8f8;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.33, 1, 0.68, 1), visibility 0s linear 0.6s;
}
html.es-veil #es-veil {
  opacity: 1;
  visibility: visible;
  transition: none;
}
html.es-leave #es-veil {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}
/* 待っている間の印：中央に金の細い線が伸び縮みする（読み込みに時間がかかったときだけ見える） */
#es-veil span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 80px;
  height: 1px;
  margin-left: -40px;
  background: #b18a3e;
  transform: scaleX(0);
  opacity: 0;
}
html.es-leave #es-veil span,
html.es-veil #es-veil span {
  opacity: 1;
  transition: opacity 0.3s 0.6s;
  animation: es-line 1.4s cubic-bezier(0.65, 0, 0.35, 1) 0.6s infinite;
}
@keyframes es-line {
  0% { transform: scaleX(0); transform-origin: left center; }
  50% { transform: scaleX(1); transform-origin: left center; }
  50.1% { transform: scaleX(1); transform-origin: right center; }
  100% { transform: scaleX(0); transform-origin: right center; }
}

/* ---------------------------------------------------------------- スクロールで出る */
html.es-js .es-up {
  opacity: 0;
  transform: translateY(24px);
}
html.es-js .es-up.is-shown {
  opacity: 1;
  transform: none;
  transition: opacity 0.9s ease-out, transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}
/* 見出しの画像（GALLERY・NEWS BLOG など）：少しだけ浮かぶ */
html.es-js .es-title {
  opacity: 0;
  transform: translateY(12px);
}
html.es-js .es-title.is-shown {
  opacity: 1;
  transform: none;
  transition: opacity 0.8s ease-out, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}
/* 写真（トップの ABOUT などの大きな写真）：少し寄った状態から落ち着く。
 * 写真そのものの透明度は lazysizes の fadein（読み込めたら出る）に任せ、ここでは大きさだけ動かす */
html.es-js .es-zoom {
  transform: scale(1.05);
}
html.es-js .es-zoom.is-shown {
  transform: none;
  transition: transform 1.6s cubic-bezier(0.16, 1, 0.3, 1);
}
/* 出終わったら、motion.js が es-up などのクラスを外す（元のホバーなどの transition を上書きしたままにしないため） */

/* ---------------------------------------------------------------- ホバー */
@media (hover: hover) {
  /* ギャラリー・お知らせの写真：枠の大きさは変えずに、中でわずかに寄る */
  #gallery li .thumb,
  .wrapperBig li.post .thumb {
    transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), clip-path 0.9s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s;
    clip-path: inset(0);
  }
  #gallery li:hover .thumb,
  .wrapperBig li.post:hover .thumb {
    transform: scale(1.06);
    clip-path: inset(2.83%);
  }
  /* MORE：矢印が少し進む（元の transform（位置合わせ）を消さないように、translate で動かす） */
  a.more,
  ul.about .text > a,
  .firstview ul li section a {
    transition: translate 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  }
  /* 2026-11：はじめは見出し・文章の箱に乗せても反応していたが、「範囲が広い」と言われ、ボタンそのものだけに */
  a.more:hover,
  ul.about .text > a:hover,
  .firstview ul li section a:hover {
    translate: 6px 0;
  }
  /* メニュー表へのリンク（HAIR SALON MENU など）・フッターのリンク：下線が左から伸びる */
  .menuLink a,
  footer .menu a {
    background: linear-gradient(currentColor, currentColor) no-repeat left bottom / 0 1px;
    transition: background-size 0.5s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s;
  }
  .menuLink a:hover,
  footer .menu a:hover {
    background-size: 100% 1px;
  }
}

/* ---------------------------------------------------------------- MORE のボタン：ホバーでハサミが少し開く
 * 元の絵（img/common/more-button.svg）を「MORE の文字」（ボタンの背景）と「上の持ち手の刃」（::before）・「下の持ち手の刃」（::after）に分け、
 * 刃を支点のネジ（絵の左から 48.92%・上から 79.88%）を中心に逆向きに回す。閉じているときは元の絵と 1 画素も違わない。
 * motion.js が、背景に more-button.svg を使っている要素に es-more を付ける */
.es-more {
  background-image: url(../img/common/more-text.svg) !important;
}
.es-more.es-more--white {
  background-image: url(../img/common/more-text-white.svg) !important;
}
.es-more.es-more--rel {
  position: relative;
}
/* 絵が上下中央に置かれているボタンは、支点の高さがその分下がる */
.es-more.es-more--center::before,
.es-more.es-more--center::after {
  transform-origin: 48.92% 79.07%;
}
.es-more::before,
.es-more::after {
  content: '';
  position: absolute;
  inset: 0;
  /* ボタンの背景と同じ大きさ・同じ置き方で描く（少しでもずれると、閉じているときに元の絵とにじみが変わる） */
  background-image: url(../img/common/more-blade-upper.svg);
  background-repeat: no-repeat;
  background-size: contain;
  background-position: inherit;
  /* 支点のネジの位置（ボタンは 4:3、絵は 69.5:50.7 で横いっぱい。絵が上寄せのとき） */
  transform-origin: 48.92% 77.7%;
  transition: rotate 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.es-more::after {
  background-image: url(../img/common/more-blade-lower.svg);
}
.es-more.es-more--white::before {
  background-image: url(../img/common/more-blade-upper-white.svg);
}
.es-more.es-more--white::after {
  background-image: url(../img/common/more-blade-lower-white.svg);
}
@media (hover: hover) {
  .es-more:hover::before {
    rotate: 9deg;
  }
  .es-more:hover::after {
    rotate: -9deg;
  }
}
/* スマホ：押したときにチョキっと開く */
.es-more:active::before {
  rotate: 9deg;
}
.es-more:active::after {
  rotate: -9deg;
}

/* ---------------------------------------------------------------- トップの最初の画面：1 つの建物に 2 つのお店
 * まず写真（動画）が出て、そのうしろで中央から左右へ 2 つのお店（白の HAIR SALON・こげ茶の SECRET BASE）が広がり、見出しが出る。
 * 白の側は地の白に溶けて見えないので、広がる前の地をほんのり温かいグレーにする（広がり終わると白に戻る）。
 * （広がる端に金の線を走らせる案は「いらない」と言われて外した）スマホは 2 つの帯が上下に並ぶので、それぞれ中央から左右へ開く。
 * 幕が上がったら（html.es-ready）始まる。見出しの位置合わせの transform を消さないように translate・scale で動かす
 * （2026-11：はじめは境目の線 → こげ茶だけが開く形だったが、「動画が先、中央から左右へ」と言われて組み直した） */
html.es-js .firstview li.left > section,
html.es-js .firstview li.right > section,
html.es-js .firstview .fvImage,
html.es-js .firstview .menubutton {
  opacity: 0;
}
html.es-js .firstview li.left {
  clip-path: inset(0 0 0 100%);
}
html.es-js .firstview li.right {
  clip-path: inset(0 100% 0 0);
}
html.es-ready .firstview,
html.es-ready .firstview::before {
  animation: es-fv-ground 2.8s ease both;
}
html.es-ready .firstview .fvImage {
  animation: es-fv-photo 1.3s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}
html.es-ready .firstview li.left {
  animation: es-fv-open-left 1.3s cubic-bezier(0.65, 0, 0.35, 1) 0.85s both;
}
html.es-ready .firstview li.right {
  animation: es-fv-open-right 1.3s cubic-bezier(0.65, 0, 0.35, 1) 0.85s both;
}
html.es-ready .firstview li.left > section {
  animation: es-fv-left 1.1s cubic-bezier(0.16, 1, 0.3, 1) 1.45s both;
}
html.es-ready .firstview li.right > section {
  animation: es-fv-right 1.1s cubic-bezier(0.16, 1, 0.3, 1) 1.45s both;
}
html.es-ready .firstview .menubutton {
  animation: es-fv-tab 0.9s cubic-bezier(0.16, 1, 0.3, 1) 2s both;
}
/* 広がる前の地（温かいグレー → 白） */
@keyframes es-fv-ground {
  0%, 60% { background-color: #ece5e3; }
  100% { background-color: #fff; }
}
@keyframes es-fv-photo {
  from { opacity: 0; scale: 0.96; }
  to { opacity: 1; scale: 1; }
}
@keyframes es-fv-open-left {
  from { clip-path: inset(0 0 0 100%); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes es-fv-open-right {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes es-fv-left {
  from { opacity: 0; translate: 50px 0; }
  to { opacity: 1; translate: 0 0; }
}
@keyframes es-fv-right {
  from { opacity: 0; translate: -50px 0; }
  to { opacity: 1; translate: 0 0; }
}
@keyframes es-fv-tab {
  from { opacity: 0; translate: 100% 0; }
  to { opacity: 1; translate: 0 0; }
}
/* スマホ：2 つの帯が、それぞれ中央から左右へ開く */
@media only screen and (max-width: 770px) {
  /* スマホの最初の画面は地が透明（元の CSS の background none）なので、終わったら透明に戻す */
  html.es-ready .firstview {
    animation-name: es-fv-ground-sp;
  }
  @keyframes es-fv-ground-sp {
    0%, 60% { background-color: #ece5e3; }
    100% { background-color: rgba(236, 229, 227, 0); }
  }
  html.es-js .firstview li.left,
  html.es-js .firstview li.right {
    clip-path: inset(0 50% 0 50%);
  }
  html.es-ready .firstview li.left,
  html.es-ready .firstview li.right {
    animation-name: es-fv-open-center;
  }
  html.es-ready .firstview li.right,
  html.es-ready .firstview li.right > section {
    animation-delay: 1.05s;
  }
  html.es-ready .firstview li.right > section {
    animation-delay: 1.65s;
  }
  @keyframes es-fv-open-center {
    from { clip-path: inset(0 50% 0 50%); }
    to { clip-path: inset(0 0 0 0); }
  }
  @keyframes es-fv-left {
    from { opacity: 0; translate: 0 16px; }
    to { opacity: 1; translate: 0 0; }
  }
  @keyframes es-fv-right {
    from { opacity: 0; translate: 0 16px; }
    to { opacity: 1; translate: 0 0; }
  }
}

/* ---------------------------------------------------------------- こげ茶の地の模様がゆっくり漂う（トップの SECRET BASE の側・フッター）
 * 模様の画像を少し大きめの ::before に移し、transform だけで 20 数秒かけて行き来させる（描き直しが起きず軽い） */
html.es-js .firstview li.right,
html.es-js footer {
  background-image: none !important;
  overflow: hidden;
}
html.es-js footer {
  background-color: #3f2d2d;
}
html.es-js .firstview li.right::before,
html.es-js footer::before {
  content: '';
  position: absolute;
  inset: -8%;
  background: url(../img/bg/home_fv.png) no-repeat center center / cover;
  animation: es-drift 24s ease-in-out infinite alternate;
  will-change: transform;
  pointer-events: none;
  z-index: 0;
}
html.es-js footer::before {
  background-image: url(../img/bg/footer-bg.png);
  animation-duration: 30s;
}
html.es-js footer > * {
  position: relative;
  z-index: 1;
}
@media only screen and (max-width: 770px) {
  html.es-js .firstview li.right > section {
    position: relative;
  }
}
@keyframes es-drift {
  0% { transform: translate3d(-3%, 2%, 0) scale(1.02); }
  100% { transform: translate3d(3%, -2%, 0) scale(1.06); }
}

/* ---------------------------------------------------------------- 「動きを減らす」設定 */
@media (prefers-reduced-motion: reduce) {
  #es-veil {
    display: none;
  }
}
