/* ==========================================================================
   front: トップページ固有（Figma: 0916_TOP 982:7471）
   共通モジュールで再現できない部分だけ。値は Figma 実値 → tokens.css に 1:1 対応。
   SPデザインは Figma に無いため、PCデザインをもとに 48rem / 64rem / 84rem で組み替えている。
   ========================================================================== */

/* --- セクション共通（Figma: px120 py80 / 見出しと中身の間 40）------------------ */
.p-front-section {
  padding-block: var(--space-64);
}

/* SP：セクションが続くときは上余白を取り、前のセクションの下余白だけで間をとる */
@media (max-width: 47.9375rem) {
  .p-front-section + .p-front-section {
    padding-top: 0;
  }
}

.p-front-section__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-40);
}

/* 拝観のご案内（Figma 33px → 8の倍数に正規化） */
.p-front-section__inner--narrow-gap {
  gap: var(--space-32);
}

.p-front-grid {
  display: grid;
  gap: var(--space-48) var(--space-40);
}

@media (min-width: 48rem) {
  .p-front-section {
    padding-block: var(--space-80);
  }

  .p-front-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)); /* Figma: 560 + 80 + 560 */
    gap: var(--space-80);
  }

  .p-front-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* Figma: 373 × 3（間 40.5）*/
  }
}

/* --- メインビジュアル（Figma: MV_0006 1440×760 / 暗幕30%）---------------------- */
/*
 * 参考: wearebuddies.net
 * - 固定背景：中身（.p-front-mv__fixed）を画面に固定し、外枠を clip-path で切り抜く。
 *   外枠が普通にスクロールして消えていくので、次のセクションが写真の上に重なってくるように見える。
 *   （clip-path は position:fixed の基準を変えないので、固定したまま外枠の範囲だけ表示される）
 * - 切り替え：次の写真が「フェード＋左からのワイプ」で前の写真の上に被さり、
 *   表示中はゆっくり右へ流れる（パン）。JS は .is-active / .is-prev を付け替えるだけ。
 * 秒数・イージングは参考サイトの実値。Figma に動きの指定は無い。
 */
.p-front-mv {
  /* SP：画面の高さに合わせる（固定の高さだと、機種によってロゴが画面の中央からずれるため。2026-11-16 ユーザー指示）。
     svh ＝ アドレスバーが出ている状態の高さ。スクロールでバーが隠れても高さが変わらず、がたつかない。
     下限 ＝ ロゴの高さ（幅6.5rem × 587/150）＋ 上下 --space-64。横向きなど低い画面でロゴがヘッダーに重ならないように。 */
  --p-front-mv-height: max(100svh, calc(6.5rem * 587 / 150 + var(--space-64) * 2));
  --p-front-mv-fade: 1s ease-in-out;
  --p-front-mv-wipe: 1.3s cubic-bezier(0.65, 0, 0.35, 1);
  --p-front-mv-pan: 6.5s cubic-bezier(0.61, 1, 0.88, 1);

  position: relative;
  height: var(--p-front-mv-height);
  clip-path: inset(0);
  background-color: var(--color-black);
}

.p-front-mv__fixed {
  position: fixed;
  top: var(--wp-admin--admin-bar--height, 0px); /* ログイン中は管理バーの下から */
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--p-front-mv-height);
}

.p-front-mv__fixed::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--color-overlay-30);
}

/* z-index:0 で重なりをこの中に閉じ込め、暗幕（::after）より下に置く */
.p-front-mv__slides {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
}

/* 待機中：透明・右70%を切り抜いた状態（JS無効時は1枚目の .is-active だけ表示）*/
.p-front-mv__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  clip-path: inset(0 70% 0 0);
  transition:
    opacity var(--p-front-mv-fade),
    clip-path var(--p-front-mv-wipe);
}

/* 前の写真は、次の写真が被さり終わるまで下に残す */
.p-front-mv__slide.is-prev {
  z-index: 1;
  opacity: 1;
  clip-path: inset(0);
}

.p-front-mv__slide.is-active {
  z-index: 2;
  opacity: 1;
  clip-path: inset(0);
}

/* 拡大しておき、端が見えない範囲で左→右へ流す */
.p-front-mv__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translateX(-2.5%) scale(1.05);
}

/* SP：縦長に切り抜くと4枚目（精進料理＋坐禅）の坐禅をする人が切れるので、右寄り（人物側）を見せる */
@media (max-width: 47.9375rem) {
  .p-front-mv__slide:nth-child(4) .p-front-mv__image {
    object-position: 85% center;
  }
}

/* .is-active → .is-prev に変わっても同じアニメーションなので途中から再開せず流れ続ける */
.p-front-mv__slide.is-active .p-front-mv__image,
.p-front-mv__slide.is-prev .p-front-mv__image {
  animation: ic-front-mv-pan var(--p-front-mv-pan) forwards;
}

@keyframes ic-front-mv-pan {
  to {
    transform: translateX(2.5%) scale(1.05);
  }
}

/* 視覚効果を減らす設定：パンとワイプを止め、フェードだけにする */
@media (prefers-reduced-motion: reduce) {
  .p-front-mv__slide {
    clip-path: none;
    transition: opacity var(--p-front-mv-fade);
  }

  .p-front-mv__image,
  .p-front-mv__slide.is-active .p-front-mv__image,
  .p-front-mv__slide.is-prev .p-front-mv__image {
    transform: none;
    animation: none;
  }
}

/* Figma: 150×587・中央から下へ46.5px（PC）。SP は画面のちょうど中央に置く。 */
.p-front-mv__title {
  position: relative;
  z-index: 1;
  width: 6.5rem; /* SP */
  /* 出現：ぼかしを解きながらフェードイン（中心から滲み広がるように見える）。
     お客様確認事項 TOP No.14：参考 byaku.site の MV ロゴ（blur 15px→0・下記イージング）の実値。
     秒数は参考の4sから、もう少し早めたいとのご要望で2.5sに短縮。
     オープニング中は止めておき、.is-opening が外れた時点でアニメーションが始まる（2回目以降はページ表示と同時）*/
  animation: ic-front-mv-title-in 2.5s cubic-bezier(0.215, 0.61, 0.355, 1) backwards;
}

@keyframes ic-front-mv-title-in {
  from {
    opacity: 0;
    filter: blur(15px);
  }
}

.p-front-mv__title img {
  display: block;
  width: 100%;
}

@media (min-width: 64rem) {
  .p-front-mv {
    --p-front-mv-height: 47.5rem; /* 760px */
  }

  .p-front-mv__title {
    width: 9.375rem; /* 150px */
    margin-top: 5.8125rem; /* 93px = 46.5 × 2（中央揃えからのずらし）*/
  }
}

/* --- オープニング（Figma: 0907_TOP画像 3107:12761 / 参考: ryuun-ji.or.jp）------------
 * 白地に「禅」の筆文字と縦書きコピーを出し、3秒後にフェードアウトしてページを見せる。
 * <html>.is-opening のときだけ表示する（front-page.php のインラインスクリプトが初回だけ付ける）。
 * フェードアウトが始まったら front-mv.js がメインビジュアルの切り替えを始め、消え終わったら .is-opening を外す。
 * 秒数は参考サイトの実値（筆文字 0.2s後に0.3s / コピー 0.8s後に0.8s / 3s後に1sで消える）。
 */
.p-front-opening {
  display: none;
}

html.is-opening .p-front-opening {
  --p-front-opening-half: calc((var(--line-height-opening) - 1) / 2 * 1em); /* 字送りの余り（上下に半分ずつ）*/

  position: fixed;
  z-index: 110; /* ドロワー(100) より上 */
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  background-color: var(--color-black);
  animation: ic-front-opening-out 1s ease-in-out 3s forwards;
}

/* 背景：コケの写真（Figma 1399:3889 塗り「画像・塗りつぶし」）＋黒50%の幕（お客様確認事項 TOP No.7 2026-10-27） */
.p-front-opening__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.p-front-opening::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background-color: var(--color-black-50);
}

/* Figma: 高さ 135.23%・中央 / 不透明度15%（1399:3889。写真の上なので通常の重ね方） */
.p-front-opening__brush {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: auto;
  max-width: none;
  height: 135.23%;
  opacity: 0.15;
  transform: translate(-50%, -50%);
  animation: ic-front-opening-in 0.3s ease-in-out 0.2s backwards;
}

/* Figma: Shippori Mincho B1 Medium 32px（Shippori Mincho で代替）/ 字送り 1.32 / 列の中心間 56px */
.p-front-opening__copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column; /* 縦書きでは右→左に列が並ぶ */
  gap: var(--space-24); /* 56 − 32 */
  margin: 0;
  font-family: var(--font-family-mincho);
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-none);
  letter-spacing: calc((var(--line-height-opening) - 1) * 1em);
  color: var(--color-white);
  writing-mode: vertical-rl;
  animation: ic-front-opening-in 0.8s ease-in-out 0.8s backwards;
}

/* 字間は各文字の後ろに付くので、半分を先頭へ回して Figma の行ボックスと同じ位置にする */
.p-front-opening__copy span {
  padding-inline-start: var(--p-front-opening-half);
  margin-inline-end: calc(var(--p-front-opening-half) * -1);
}

.p-front-opening__copy .p-front-opening__copy-sub {
  padding-inline-start: calc(var(--space-56) + var(--p-front-opening-half)); /* Figma: pt 56 */
}

@keyframes ic-front-opening-in {
  from {
    opacity: 0;
  }
}

@keyframes ic-front-opening-out {
  to {
    visibility: hidden;
    opacity: 0;
  }
}

/* オープニング中はメインビジュアルのパンを止めておき、フェードアウトの開始と同時に1枚目を流し始める
   （消えてから動き出すと一度止まって見えるため、写真が透けて見え始めた時点で動いているようにする）*/
html.is-opening [data-ic-mv]:not(.is-playing) .p-front-mv__image {
  animation: none;
}

/* タイトルはオープニングが消え終わるまで透明で待機。front-mv.js が .is-opening を外すとぼかしから現れる */
html.is-opening .p-front-mv__title {
  opacity: 0;
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .p-front-mv__title {
    animation-name: ic-front-opening-in; /* ぼかしなしのフェードのみ */
    animation-duration: 1s;
  }
}

/* --- 大安禅寺について（Figma: about_0010 / py160 px180）------------------------ */
.p-front-about {
  position: relative;
  padding-block: var(--space-80);
  overflow: hidden;
}

/* SP：下の余白はセクションではなく中身（.p-front-about__inner）に付ける。
   次のお知らせにも上余白があるので控えめに（--space-40 → SP では 32px。2026-10-21） */
@media (max-width: 47.9375rem) {
  .p-front-about {
    padding-bottom: 0;
  }

  .p-front-about__inner {
    padding-bottom: var(--space-40);
  }
}

/* 家紋（Figma: 620×620 / left -142 / 中央から下へ50px） */
.p-front-about::before {
  content: "";
  position: absolute;
  top: calc(50% + 3.125rem); /* +50px */
  left: -8.875rem; /* -142px */
  width: 38.75rem; /* 620px */
  aspect-ratio: 1;
  background: url(../../images/kamon.svg) no-repeat center / contain;
  transform: translateY(-50%);
}

/* SP：セクションの上下で家紋が途切れないよう、縮めて上下中央に置く（セクションの高さ 650px 前後に収まる大きさ） */
@media (max-width: 47.9375rem) {
  .p-front-about::before {
    top: 50%;
    width: 34rem; /* 544px */
  }
}

.p-front-about__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-48);
}

.p-front-about__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-40);
}

.p-front-about__title {
  font-family: var(--font-family-mincho);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-h2-lead);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-widest);
}

.p-front-about__text {
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-widest);
}

/* SPでは文の途中の改行を外す */
.p-front-about__text br {
  display: none;
}

.p-front-about__images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-16);
}

.p-front-about__images img {
  width: 100%;
  aspect-ratio: 405 / 244;
  object-fit: cover;
}

/* SP・タブレット：写真を「大安禅寺について」ボタンより上に出す（本文の箱をほどいて並べ替える） */
@media (max-width: 63.9375rem) {
  .p-front-about__inner {
    gap: var(--space-40);
  }

  .p-front-about__body {
    display: contents;
  }

  .p-front-about__body > .c-button {
    order: 1;
    align-self: flex-start;
  }
}

@media (min-width: 48rem) {
  .p-front-about__title {
    font-size: var(--font-size-h2);
  }
}

@media (min-width: 64rem) {
  .p-front-about {
    padding-block: var(--space-160);
  }

  .p-front-about__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    max-width: calc(67.5rem + var(--space-24) * 2); /* 1080px = 1440 - 180×2 */
  }

  .p-front-about__text br {
    display: inline;
  }

  .p-front-about__images {
    flex: none;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-40);
    width: 37.5%; /* 405 / 1080 */
  }
}

@media (min-width: 84rem) {
  .p-front-about__title {
    font-size: var(--font-size-h1);
    white-space: nowrap;
  }
}

/* --- お知らせ（Figma: News / py80 / 見出しと本体の間 120）----------------------- */
.p-front-news {
  padding-block: var(--space-64);
}

.p-front-news__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-32);
}

/* SPでは縦書きをやめて横組みにする */
.p-front-news .c-heading--vertical {
  flex-direction: column;
  justify-content: flex-start;
}

.p-front-news .c-heading--vertical > * {
  writing-mode: horizontal-tb;
}

.p-front-news .c-heading--vertical .c-heading__en {
  padding-inline: 0;
}

.p-front-news__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-32);
  min-width: 0;
}

/* SPは1行の横スクロール。コンテナの左右余白を打ち消して画面端まで流す */
@media (min-width: 64rem) {
  .p-front-news {
    padding-block: var(--space-80);
  }

  .p-front-news__inner {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-120);
  }

  .p-front-news .c-heading--vertical {
    flex: none;
    flex-direction: row-reverse;
    justify-content: flex-end;
  }

  .p-front-news .c-heading--vertical > * {
    writing-mode: vertical-rl;
  }

  .p-front-news .c-heading--vertical .c-heading__en {
    padding-inline: var(--space-10);
  }

  .p-front-news__main {
    flex: 1 0 0;
  }
}

/* --- 写真コラージュ（Figma: Frame 4683 / 1200×750 の中に絶対配置）--------------- */
.p-front-collage {
  padding-block: var(--space-64);
  background-color: var(--color-bg);
}

.p-front-collage__grid {
  position: relative;
  aspect-ratio: 1200 / 750;
}

.p-front-collage__item {
  position: absolute;
  overflow: hidden;
}

.p-front-collage__item picture {
  display: block;
}

.p-front-collage__image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* 出現：ぼかし＋モノクロからその場でフェードイン（front-collage.js が .is-enabled / .is-visible を付ける。
   JS無効・視覚効果を減らす設定のときはクラスが付かず、最初から表示されたまま）*/
.p-front-collage__grid.is-enabled .p-front-collage__item {
  opacity: 0;
}

.p-front-collage__grid.is-enabled .p-front-collage__item.is-visible {
  animation: c-inview-fade 0.8s forwards; /* keyframes は components/core.css */
}

/* 1枚ずつ時間差で浮かび上がらせる（お客様確認事項 TOP No.5「四隅の画像表示にもう少し時間差」2026-10-27）。
   同時に画面に入っても 左上 → 右上 → 中央 → 右 → 下 の順に 0.4秒ずつずらす */
.p-front-collage__grid.is-enabled .p-front-collage__item--2.is-visible {
  animation-delay: 0.4s;
}

.p-front-collage__grid.is-enabled .p-front-collage__item--3.is-visible {
  animation-delay: 0.8s;
}

.p-front-collage__grid.is-enabled .p-front-collage__item--4.is-visible {
  animation-delay: 1.2s;
}

.p-front-collage__grid.is-enabled .p-front-collage__item--5.is-visible {
  animation-delay: 1.6s;
}

/* パララックス：枠は固定のまま、1.1倍にした写真だけを上下に動かす。
   --ic-parallax は JS が入れる -0.5〜0.5（画面下端で 0.5、上端で -0.5）。
   動く幅は写真の高さの10%＝拡大で増えた分にちょうど収まる */
.p-front-collage__grid.is-enabled .p-front-collage__image {
  transform: translate3d(0, calc(var(--ic-parallax, 0) * 10%), 0) scale(1.1);
  will-change: transform;
}

/* 位置・幅は Figma の px を 1200 / 750 に対する割合にしたもの */
.p-front-collage__item--1 {
  top: 0;
  left: 0;
  width: 35%; /* 420 */
}

.p-front-collage__item--2 {
  top: 0;
  left: 65.083%; /* 781 */
  width: 34.917%; /* 419 */
}

.p-front-collage__item--3 {
  top: 34.667%; /* 260 */
  left: 41.667%; /* 500 */
  width: 25.667%; /* 308 */
}

.p-front-collage__item--4 {
  top: 44.667%; /* 335 */
  left: 77.667%; /* 932 */
  width: 19%; /* 228 */
}

.p-front-collage__item--5 {
  top: 71.467%; /* 536 */
  left: 59.75%; /* 717 */
  width: 25.25%; /* 303 */
}

/* SP（Figma: ギャラリー 3155:17223 / 400幅・py40 px20 → 中身 360×444）。
   写真は SP 用に切り出した画像（<picture> の source）。位置・幅は 360 / 444 に対する割合。
   重なりは HTML の順（1 の参道の写真がいちばん下）。
   ※ 左右の余白は Figma 20px だがトークンに無いため、ほかのセクションと同じ .l-container（24px）のまま */
@media (max-width: 47.9375rem) {
  /* 背景は白（お客様確認事項 TOP No.12：写真の配置と背景の範囲が合わず違和感があるため。PCはオフホワイトのまま） */
  .p-front-collage {
    padding-block: var(--space-40);
    background-color: var(--color-white);
  }

  .p-front-collage__grid {
    aspect-ratio: 360 / 444;
  }

  .p-front-collage__item--1 {
    top: 21.396%; /* 95 */
    left: 23.24%; /* 83.66 */
    width: 54.5%; /* 196.2 */
  }

  .p-front-collage__item--2 {
    top: 0;
    left: 0;
    width: 47.01%; /* 169.2 */
  }

  .p-front-collage__item--3 {
    top: 13.739%; /* 61 */
    left: 57.2%; /* 205.9 */
    width: 41.35%; /* 148.9 */
  }

  .p-front-collage__item--4 {
    top: 61.937%; /* 275 */
    left: 2.26%; /* 8.1 */
    width: 36.9%; /* 132.8 */
  }

  .p-front-collage__item--5 {
    top: 75%; /* 333 */
    left: 51.83%; /* 186.6 */
    width: 48.17%; /* 173.4 */
  }
}

@media (min-width: 64rem) {
  .p-front-collage {
    padding-block: var(--space-80);
  }
}

/* --- 法話バナー（Figma: Frame 1182 1200×565。上90pxは住職の写真がはみ出す分）---- */
.p-front-houwa {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
}

.p-front-houwa__bg {
  display: none;
}

.p-front-houwa__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-24);
  padding: var(--space-32) var(--space-24);
  overflow: hidden;
  background-color: var(--color-red);
  color: var(--color-white);
}

/* 家紋（Figma: 449×449 / left -190 / 中央から上へ183px） */
.p-front-houwa__panel::before {
  content: "";
  position: absolute;
  top: calc(50% - 11.4375rem); /* -183px */
  left: -11.875rem; /* -190px */
  width: 28.0625rem; /* 449px */
  aspect-ratio: 1;
  background: url(../../images/kamon-on-red.svg) no-repeat center / contain;
  transform: translateY(-50%);
}

.p-front-houwa__panel > * {
  position: relative;
}

.p-front-houwa__title img {
  display: block;
  width: min(100%, 26.1875rem); /* 419px */
}

/* SP：パネルをコンパクトに（余白・間隔を一段詰め、見出し画像を 240px に。お客様要望 2026-10-21） */
@media (max-width: 47.9375rem) {
  .p-front-houwa__panel {
    gap: var(--space-16);
    padding-block: var(--space-16) var(--space-24); /* 上は見出し画像の上に余白があるので一段詰める */
  }

  .p-front-houwa__title img {
    width: min(100%, 15rem); /* 240px */
  }
}

.p-front-houwa__text {
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-body);
  line-height: var(--line-height-loose);
  letter-spacing: var(--letter-spacing-3);
}

.p-front-houwa__visual {
  position: relative;
  aspect-ratio: 738 / 565;
  overflow: hidden;
  background: url(../../images/front/houwa-bg.webp) center / cover no-repeat;
}

.p-front-houwa__visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--color-cream-75);
}

.p-front-houwa__photo {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
}

/* SP・タブレット：写真枠（738×565）が写真（738×645）より低いので、上端基準にして頭が切れないようにする
   （差し替えた住職写真は頭が上寄り。お客様確認事項 TOP No.9 2026-10-27） */
@media (max-width: 63.9375rem) {
  .p-front-houwa__photo {
    top: 0;
    bottom: auto;
  }
}

/* 位置は Figma の px を写真枠 738×645 に対する割合にしたもの */
.p-front-houwa__name {
  position: absolute;
  top: 12%;
  left: 5%;
  width: 13.8%; /* 102 / 738 */
}

/* 影は縁取りの線から落とす。線が細く1回だとFigmaよりかなり薄いため、同じ影を2回重ねる。 */
.p-front-houwa__name img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(var(--shadow-text)) drop-shadow(var(--shadow-text));
}

/* 縁取りの内側に影が透けて黒く見えるのを、文字型の半透明な白で中和する（影の上に重ねる）。 */
.p-front-houwa__name::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* mask 未対応のブラウザで白い矩形が出ないよう、色とマスクはセットで当てる */
@supports ((-webkit-mask: url("")) or (mask: url(""))) {
  .p-front-houwa__name::after {
    background-color: var(--color-name-veil);
    -webkit-mask: url(../../images/front/houwa-name-fill.svg) no-repeat center / 100% 100%;
    mask: url(../../images/front/houwa-name-fill.svg) no-repeat center / 100% 100%;
  }
}

/* 金の帯（縦書き）。もとはアウトライン化した SVG（131×514）。文言を変えやすいよう HTML の文字にした
   （お客様確認事項 TOP No.2 2026-11）。寸法は旧 SVG の実測：文字 40px・字送り 44px（＋0.1em）・帯の幅 58px・帯の間 15px。
   右の帯から読むので並びは row-reverse。帯の長さは文字数なりで、上端をそろえる */
.p-front-houwa__labels {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: var(--space-8);
  margin: 0;
  font-family: var(--font-family-mincho);
  font-weight: var(--font-weight-medium); /* 500（ご指示 2026-11-06。旧 SVG より細め）*/
  font-size: var(--font-size-h3-lg); /* SP 18.67px（ご指示「18px ぐらい」2026-11-06。いちばん近いトークン）*/
  line-height: var(--line-height-none);
  letter-spacing: var(--letter-spacing-widest);
  color: var(--color-white);
}

.p-front-houwa__label {
  padding: var(--space-8) var(--space-4);
  background-color: var(--color-gold);
  writing-mode: vertical-rl;
  white-space: nowrap;
}

@media (min-width: 48rem) {
  .p-front-houwa__labels {
    gap: var(--space-16);
    font-size: var(--font-size-amount);
  }

  .p-front-houwa__label {
    padding: var(--space-16) var(--space-8);
  }
}

/* SP：住職の写真を大きく（顔が枠いっぱいに来るように拡大して右寄せ・頭の上を少し詰める）。
   お客様確認事項 TOP No.2（2026-11）。参考画像が無いため見た目で調整した値 */
@media (max-width: 47.9375rem) {
  .p-front-houwa__photo {
    top: -18%;
    right: 0;
    left: auto;
    width: 120%;
    max-width: none; /* 共通の img { max-width: 100% } が効くと拡大されず、上にずらした分だけ下に隙間が出る */
  }
}

@media (min-width: 64rem) {
  .p-front-houwa {
    display: block;
    padding-top: 5.625rem; /* 90px */
  }

  /* 背景（Figma: x 0–1170 / y 90–565）＋クリーム色の幕 */
  .p-front-houwa__bg {
    position: absolute;
    inset: 5.625rem 2.5% 0 0; /* 右 30 / 1200 */
    display: block;
    background: url(../../images/front/houwa-bg.webp) center / cover no-repeat;
  }

  .p-front-houwa__bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: var(--color-cream-75);
  }

  /* 赤パネル（Figma: 581×475。中身は left48 / 見出し top48 / ボタン下 約66） */
  .p-front-houwa__panel {
    justify-content: center;
    width: 48.417%; /* 581 / 1200 */
    min-height: 29.6875rem; /* 475px */
    padding: var(--space-48);
    padding-right: var(--space-32); /* Figma: 本文の右端 545 → 581 - 545 = 36 ≒ 32 */
  }

  .p-front-houwa__title {
    margin-bottom: calc(var(--space-24) * -1); /* Figma: 見出しと本文の間はほぼ 0 */
  }

  .p-front-houwa__text {
    font-size: var(--font-size-h3);
  }

  .p-front-houwa__visual {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
    overflow: visible;
    background: none;
    pointer-events: none;
  }

  .p-front-houwa__visual::before {
    content: none;
  }

  /* 住職の写真（Figma: 738×645 / right 30 / top -80 → 下端はバナー下端） */
  .p-front-houwa__photo {
    right: 2.5%;
    left: auto;
    width: 61.5%; /* 738 / 1200 */
  }

  /* Figma: 中心 x 667.5 / 幅 102 → left 616.5、top 111（565 に対して） */
  .p-front-houwa__name {
    top: 19.6%;
    left: 51.375%;
    width: 8.5%;
  }

}

/* --- ご供養・ご祈祷（Figma: Service03_WF 982:7749 / py120 / 列間160）------------ */
.p-front-service {
  padding-block: var(--space-64);
}

.p-front-service__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-40);
}

.p-front-service__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-24);
}

/* SPでは縦書きをやめて横組みにする */
.p-front-service .c-heading--vertical {
  flex-direction: column;
  justify-content: flex-start;
}

.p-front-service .c-heading--vertical > * {
  writing-mode: horizontal-tb;
}

.p-front-service .c-heading--vertical .c-heading__en {
  padding-inline: 0;
}

.p-front-service .c-heading--vertical.c-heading--md .c-heading__ja {
  line-height: var(--line-height-heading);
}

.p-front-service__lead {
  line-height: var(--line-height-loose);
}

.p-front-service__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-40);
}

@media (min-width: 64rem) {
  .p-front-service {
    padding-block: var(--space-120);
  }

  .p-front-service__inner {
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: var(--space-80);
  }

  .p-front-service__head {
    flex: none;
    flex-direction: row-reverse;
    align-items: flex-start;
  }

  .p-front-service .c-heading--vertical {
    flex-direction: row-reverse;
    justify-content: flex-end;
  }

  .p-front-service .c-heading--vertical > * {
    writing-mode: vertical-rl;
  }

  .p-front-service .c-heading--vertical .c-heading__en {
    padding-inline: var(--space-10);
  }

  .p-front-service .c-heading--vertical.c-heading--md .c-heading__ja {
    line-height: var(--line-height-none);
  }

  .p-front-service__lead {
    padding-top: var(--space-24);
    line-height: var(--line-height-none);
    letter-spacing: calc((var(--line-height-vertical) - 1) * 1em);
    writing-mode: vertical-rl;
  }

  .p-front-service__list {
    flex: 1 0 0;
  }
}

@media (min-width: 84rem) {
  .p-front-service__inner {
    gap: var(--space-160);
  }
}

/* --- 写真帯（Figma: Frame 4694 1440×460）--------------------------------------- */
.p-front-wide img {
  display: block;
  width: 100%;
  height: 15rem; /* SP */
  object-fit: cover;
}

@media (min-width: 64rem) {
  .p-front-wide img {
    height: 28.75rem; /* 460px */
  }
}

/* --- ギャラリー（Figma: Interview_0001 982:7864 / py160 / 左120・右は画面端まで）- */
.p-front-gallery {
  padding-block: var(--space-80);
  overflow: hidden;
}

/* SP：上の余白なし（直前のセクションの下余白で足りる） */
@media (max-width: 47.9375rem) {
  .p-front-gallery {
    padding-top: 0;
  }
}

.p-front-gallery__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-40);
  padding-left: var(--space-24);
}

.p-front-gallery__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-40);
  padding-right: var(--space-24);
}

/* SP：見出しとボタンの間を詰め、ボタンは右寄せ */
@media (max-width: 47.9375rem) {
  .p-front-gallery__body {
    gap: var(--space-24);
  }

  .p-front-gallery__body > .c-button {
    align-self: flex-end;
  }
}

/* 写真のループ（参考: 太秦映画村 TOP .about）。同じ並びを2回続けた列を、1組ぶん（＝列の半分）だけ左へ
   一定の速さで動かし、終わったら最初に戻す。半分ちょうどで継ぎ目が合うよう、間は gap ではなく
   各写真の右側の margin でとる。速さは枚数に比例させ（--ic-gallery-count は front-page.php が入れる）、
   1枚あたりの時間で決める。 */
.p-front-gallery__slider {
  overflow: hidden;
}

/* PC の横並びになるまでは、左の余白（.p-front-gallery__inner の padding-left）を打ち消して画面幅いっぱいに流す */
@media (max-width: 63.9375rem) {
  .p-front-gallery__slider {
    margin-left: calc(var(--space-24) * -1);
  }
}

.p-front-gallery__list {
  display: flex;
  width: max-content;
  animation: ic-gallery-loop calc(var(--ic-gallery-count, 6) * 12s) linear infinite;
}

.p-front-gallery__list li {
  flex: none;
  width: min(80vw, 37.5rem);
  margin-right: var(--space-16);
}

.p-front-gallery__list img {
  display: block;
  width: 100%;
  aspect-ratio: 600 / 370;
  object-fit: cover;
}

@keyframes ic-gallery-loop {
  to {
    transform: translateX(-50%);
  }
}

/* 動きを減らす設定：流さず、手で横にスクロールして見る（複製の2組目は出さない） */
@media (prefers-reduced-motion: reduce) {
  .p-front-gallery__slider {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .p-front-gallery__slider::-webkit-scrollbar {
    display: none;
  }

  .p-front-gallery__list {
    animation: none;
  }

  .p-front-gallery__list li {
    scroll-snap-align: start;
  }

  .p-front-gallery__list li[aria-hidden="true"] {
    display: none;
  }
}

@media (min-width: 64rem) {
  .p-front-gallery {
    padding-block: var(--space-160);
  }

  /* 左端をコンテナ（1200px）の左端に合わせ、右は画面端まで伸ばす */
  .p-front-gallery__inner {
    flex-direction: row;
    align-items: center;
    gap: var(--space-80);
    padding-left: max(var(--space-24), calc((100% - var(--container-max)) / 2));
  }

  .p-front-gallery__body {
    flex: none;
    width: 26.25rem; /* 420px */
    padding-right: 0;
  }

  .p-front-gallery__slider {
    flex: 1 0 0;
    min-width: 0;
  }

  .p-front-gallery__list {
    animation-duration: calc(var(--ic-gallery-count, 6) * 20s);
  }

  .p-front-gallery__list li {
    width: 37.5rem; /* 600px */
    margin-right: var(--space-32);
  }
}

/* --- Instagram（Figma: Interview_0001 982:7881 / py160 / 間80）------------------ */
.p-front-instagram {
  padding-block: var(--space-80);
  background-color: var(--color-bg);
}

/* SP：上下の余白を詰める */
@media (max-width: 47.9375rem) {
  .p-front-instagram {
    padding-block: var(--space-64);
  }
}

.p-front-instagram__inner {
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-40);
}

.p-front-instagram__feed img {
  display: block;
  width: 100%;
}

.p-front-instagram__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-40);
}

/* SP：見出しとボタンの間を詰め、ボタンは右寄せ */
@media (max-width: 47.9375rem) {
  .p-front-instagram__body {
    gap: var(--space-24);
  }

  .p-front-instagram__body > .c-button {
    align-self: flex-end;
  }
}

@media (min-width: 64rem) {
  .p-front-instagram {
    padding-block: var(--space-160);
  }

  .p-front-instagram__inner {
    flex-direction: row;
    align-items: center;
    gap: var(--space-80);
  }

  .p-front-instagram__feed {
    flex: 1 0 0;
    min-width: 0;
  }

  .p-front-instagram__body {
    flex: none;
    width: 26.25rem; /* 420px */
  }
}
