/* =========================================================
   00 ヒーロー（#top）■ 墨・白帯
   縦書きの大見出し「黒帯も、最初は白帯だった。」＋落款のような「生涯修行」。
   スマホ：左に写真の縦長パネル、右に縦書き。
   768px〜：写真を全面に敷き、右側に縦書き。
   読み込み時に一度だけ：墨の拭き取り → 写真が落ち着く → 見出しが一行ずつ →
   落款 → 本文 → 最後に白帯の一本線が横に引かれて止まる。
   ========================================================= */

.hero {
  --hero-fs: clamp(2.1rem, min(12.2vw, calc((100svh - 410px) / 9.4)), 3.5rem);
  --hero-pad-top: calc(var(--header-h) + env(safe-area-inset-top) + 14px);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "media mark"
    "copy  copy"
    "belt  belt";
  column-gap: clamp(12px, 4vw, 20px);
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--hero-pad-top) max(var(--gutter), env(safe-area-inset-right)) 0 0;
  overflow: hidden;
  isolation: isolate;
}
.hero__inner { display: contents; }

/* ---------- 写真 ---------- */
.hero__media {
  grid-area: media;
  position: relative;
  min-height: calc(var(--hero-fs) * 9.4);
  overflow: hidden;
  background: var(--sumi-3);
}
.hero__media picture { position: absolute; inset: 0; }
.hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 34%;
  transform-origin: 40% 40%;
}
/* スマホ：パネルの右と下を少しだけ墨に沈める */
.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(15, 14, 13, 0) 70%, rgba(15, 14, 13, .35) 100%),
    linear-gradient(180deg, rgba(15, 14, 13, .1) 0%, rgba(15, 14, 13, 0) 30%, rgba(15, 14, 13, 0) 72%, rgba(15, 14, 13, .45) 100%);
}

/* ---------- 縦書きの大見出し＋落款 ---------- */
.hero__mark {
  grid-area: mark;
  position: relative;
  align-self: start;
  justify-self: end;
}
.hero__title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  margin: 0;
  font-weight: 800;
  font-size: var(--hero-fs);
  line-height: 1.28;
  letter-spacing: .04em;
  color: var(--on-sumi);
  word-break: normal;
  text-wrap: nowrap;
}
.hero__col {
  display: block;
  white-space: nowrap;
}
/* 一行目は一字半さげて、二行目の長さを際立たせる */
.hero__col:first-child { padding-top: 1.5em; }

/* 落款：朱の角印に「生涯修行」（右の列から読む） */
.hero__seal {
  position: absolute;
  right: calc(100% + 8px);
  bottom: 2px;
  writing-mode: vertical-rl;
  box-sizing: content-box;
  width: 2.3em;
  height: 2.08em;
  padding: .42em .36em;
  background: var(--shu);
  color: #fff;
  font-family: var(--font-mincho);
  font-weight: 800;
  font-size: clamp(.8rem, 3.4vw, 1rem);
  line-height: 1.15;
  letter-spacing: 0;
  text-align: center;
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px var(--shu), inset 0 0 0 3px rgba(255, 255, 255, .55);
}

/* ---------- 本文・CTA ---------- */
.hero__copy {
  grid-area: copy;
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 26px 0 0 max(var(--gutter), env(safe-area-inset-left));
}
.hero__where {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .14em;
  line-height: 1.6;
  color: var(--on-sumi-2);
}
.hero__where-sep {
  flex-basis: 100%;
  height: 0;
}
@media (min-width: 768px) {
  .hero__where-sep { flex-basis: auto; width: 18px; height: 1px; background: rgba(242, 238, 230, .4); }
}
.hero__lead {
  font-family: var(--font-mincho);
  font-weight: 700;
  font-size: clamp(1.05rem, 4.6vw, 1.3rem);
  line-height: 1.85;
  letter-spacing: .06em;
  color: var(--on-sumi);
  text-wrap: pretty;
  word-break: auto-phrase;
}
.hero__ctas {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 4px;
}
.hero__ctas .btn { min-height: 54px; padding-inline: 1em; }
@media (min-width: 400px) and (max-width: 767px) {
  .hero__ctas { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
  .hero__ctas .btn { padding-inline: .6em; letter-spacing: .04em; font-size: .95rem; }
}

/* ---------- 白帯の一本線 ---------- */
.hero__belt {
  grid-area: belt;
  position: relative;
  height: 4px;
  margin: 28px 0 calc(28px + env(safe-area-inset-bottom));
  margin-right: calc(-1 * max(var(--gutter), env(safe-area-inset-right)));
}
.hero__belt-line,
.hero__belt-fill {
  position: absolute;
  inset: 0;
  background: var(--belt-white, #F4F1EA);
  transform-origin: left center;
  /* 締めた帯の織り目：細い横筋を一本 */
  background-image: linear-gradient(180deg, transparent 45%, rgba(15, 14, 13, .12) 45%, rgba(15, 14, 13, .12) 60%, transparent 60%);
}

/* 次の写真・動画までのタイマー（js/hero.js が最初から .is-timer を付ける。開幕の線の演出はなし）：
   線は薄い軌道になり、明るい帯が左から伸びて、入れ替わりで戻る。動きなしでは今の線のまま */
.hero__belt-fill { opacity: 0; transform: scaleX(0); }
.hero.is-timer .hero__belt-line { opacity: .25; animation: hero-track .8s ease both; }
.hero.is-timer .hero__belt-fill { opacity: 1; }

/* ---------- タブレット・PC：写真を全面に ---------- */
@media (min-width: 768px) {
  .hero {
    --hero-fs: clamp(3rem, calc((100svh - var(--header-h) - 124px) / 9.4), 6.6rem);
    grid-template-columns: minmax(0, 1fr) minmax(0, 31rem) auto;
    grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas:
      ".    .    mark"
      "copy copy mark"
      "belt belt belt";
    column-gap: clamp(28px, 4vw, 56px);
    padding: calc(var(--header-h) + clamp(20px, 3.5svh, 40px)) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  }
  .hero__media {
    grid-area: auto;
    position: absolute;
    inset: 0;
    z-index: -1;
    min-height: 0;
    background: var(--sumi);
  }
  .hero__img { object-position: 12% 40%; transform-origin: 20% 45%; }
  .hero__media::after {
    background:
      linear-gradient(180deg, rgba(15, 14, 13, .62) 0%, rgba(15, 14, 13, 0) 18%),
      linear-gradient(0deg, rgba(15, 14, 13, .94) 0%, rgba(15, 14, 13, .72) 26%, rgba(15, 14, 13, 0) 58%),
      linear-gradient(270deg, rgba(15, 14, 13, .94) 0%, rgba(15, 14, 13, .82) 22%, rgba(15, 14, 13, .42) 40%, rgba(15, 14, 13, 0) 60%),
      rgba(15, 14, 13, .1);
  }
  .hero__mark { align-self: start; }
  .hero__title { line-height: 1.32; }
  .hero__seal { font-size: 1.05rem; right: calc(100% + 12px); }
  .hero__copy {
    grid-area: copy;
    align-self: end;
    justify-self: start;
    max-width: 31rem;
    padding: 0;
  }
  .hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; }
  .hero__ctas .btn { padding-inline: 1.4em; }
  .hero__belt {
    margin: clamp(28px, 4svh, 44px) calc(-1 * max(var(--gutter), env(safe-area-inset-right))) calc(clamp(28px, 4svh, 44px) + env(safe-area-inset-bottom)) calc(-1 * max(var(--gutter), env(safe-area-inset-left)));
  }
}

@media (min-width: 1100px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 31rem) auto;
    grid-template-areas:
      ".    .    mark"
      ".    copy mark"
      "belt belt belt";
  }
  .hero__img { object-position: 22% 42%; }
  .hero__copy { justify-self: end; }
}

/* =========================================================
   背景の入れ替え（js/hero.js が動きありの時だけ .hero__layer を足す）
   スマホ：動画2枚を重ねてクロスフェード。768px〜：写真のクロスフェード＋ゆっくりズーム。
   1枚目（HTML の写真）は常に一番下。層は写真の上・グラデーション（::after）の下。
   ========================================================= */
.hero__layer { position: absolute; inset: 0; z-index: 0; }
.hero__vid,
.hero__extra {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .8s ease;
}
.hero__vid { object-position: 42% 50%; }
.hero__extra { object-position: 30% 40%; transform-origin: 30% 45%; transition-duration: 1.6s; }
.hero__vid.is-on, .hero__extra.is-on { opacity: 1; z-index: 2; }
.hero__vid.is-prev, .hero__extra.is-prev { opacity: 1; z-index: 1; }
.hero__img.is-kb, .hero__extra.is-kb { animation: hero-kb 8.4s linear both; }
.hero__media.is-paused .is-kb { animation-play-state: paused; }
@keyframes hero-kb {
  from { transform: none; }
  to { transform: scale(1.08); }
}

/* =========================================================
   読み込み時の演出（一度だけ）
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  .hero__media {
    -webkit-mask-image: linear-gradient(255deg, #000 42%, transparent 58%);
    mask-image: linear-gradient(255deg, #000 42%, transparent 58%);
    -webkit-mask-size: 260% 100%;
    mask-size: 260% 100%;
    -webkit-mask-position: 100% 0;
    mask-position: 100% 0;
    animation: hero-wipe 1.5s cubic-bezier(.65, .05, .25, 1) .1s both;
  }
  .hero__img { animation: hero-settle 3.2s cubic-bezier(.2, .7, .2, 1) both; }
  .hero__col { animation: hero-ink 1.1s cubic-bezier(.5, 0, .2, 1) both; }
  .hero__col:nth-child(1) { animation-delay: .8s; }
  .hero__col:nth-child(2) { animation-delay: 1.15s; }
  .hero__seal { animation: hero-stamp .55s cubic-bezier(.3, 1.4, .5, 1) 2.05s both; }
  .hero__copy { animation: hero-rise .9s var(--ease) 1.7s both; }
}

@keyframes hero-wipe {
  from { -webkit-mask-position: 0 0; mask-position: 0 0; }
  to { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
}
@keyframes hero-settle {
  from { transform: scale(1.06); }
  to { transform: none; }
}
@keyframes hero-ink {
  from { clip-path: inset(-.3em -.3em 100% -.3em); opacity: .3; }
  to { clip-path: inset(-.3em -.3em -.3em -.3em); opacity: 1; }
}
@keyframes hero-stamp {
  from { opacity: 0; transform: scale(1.35); }
  to { opacity: 1; transform: none; }
}
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes hero-track {
  from { opacity: 0; }
  to { opacity: .25; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__media, .hero__img, .hero__col, .hero__seal, .hero__copy, .hero__belt-line { animation: none !important; }
}
