/* 株式会社聖小 LP の見た目の改修(018)。style.css(配色・文字・基本のレイアウト)の上に重ねる。
   ・写真はすべてイメージ。写真の近くに .img-note「イメージ」を出す
   ・動きは visual.js が「画面に入ったら」クラスを足して CSS で動かす。JS が無くても中身はすべて見える
   ・「動きを減らす」設定(prefers-reduced-motion)では、動き・切り替え・視差をすべて止める */

:root {
  --hero-interval: 6.5s;   /* visual.js の INTERVAL と同じ */
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --header-h: 64px;
}
@media (max-width: 899px) { :root { --header-h: 112px; } } /* スマホはナビが2段目にある */

/* ---------- イメージの表示 ---------- */
.img-note {
  position: absolute; right: 8px; bottom: 8px; z-index: 3; margin: 0;
  padding: 2px 8px; border-radius: 2px;
  background: rgba(6, 22, 44, .62); color: #fff;
  font-size: 11px; font-weight: 500; letter-spacing: .08em; line-height: 1.6;
  pointer-events: none;
}

/* ---------- ファーストビュー ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: calc(100svh - var(--header-h)); min-height: max(540px, calc(100svh - var(--header-h)));
  display: flex; align-items: center;
  padding: 72px 0 112px;
  background: var(--ink);
  /* 下の端を斜めに切る */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 5vw), 0 100%);
}
.hero-slides { position: absolute; inset: 0; z-index: 0; }
.hero-slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 1.4s ease; }
.hero-slide.is-active { opacity: 1; z-index: 1; }
.hero-img { width: 100%; height: 100%; object-fit: cover; display: block; transform-origin: 60% 50%; }
/* 切り替わった写真は、少し大きい所からゆっくり戻る(ズームアウト) */
.hero-slide.is-active .hero-img { animation: hero-zoom calc(var(--hero-interval) + 1.6s) var(--ease-out) both; }
@keyframes hero-zoom { from { transform: scale(1.12); } to { transform: scale(1); } }

.hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(100deg, rgba(6, 22, 44, .9) 0%, rgba(6, 22, 44, .72) 45%, rgba(6, 22, 44, .38) 100%),
    linear-gradient(0deg, rgba(6, 22, 44, .55) 0%, rgba(6, 22, 44, 0) 40%);
}
.hero .hero-inner { position: relative; z-index: 2; width: 100%; } /* flex の中で .wrap が縮まないように(ロゴと左を揃える) */
.hero h1 { font-size: clamp(36px, 9vw, 76px); text-shadow: 0 2px 24px rgba(0, 0, 0, .25); }

/* キャッチコピー: 行ごとに下から出る(読み込んだとき) */
.hero-line { display: inline-block; animation: hero-line-in 1s var(--ease-out) both; }
.hero .eyebrow .hero-line { animation-delay: .15s; }
.hero h1 .hero-line:nth-of-type(1) { animation-delay: .3s; }
.hero h1 .hero-line:nth-of-type(2) { animation-delay: .45s; }
.hero .lead .hero-line { animation-delay: .65s; }
.hero-line-block { animation: hero-line-in 1s var(--ease-out) .8s both; }
@keyframes hero-line-in { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

/* 写真の切り替え(下の左)。選んでいる方に、次へ進むまでの線が伸びる */
.hero-dots {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: calc(5vw + 24px);
  display: flex; gap: 20px; max-width: var(--wrap); margin: 0 auto; padding: 0 16px;
}
@media (min-width: 768px) { .hero-dots { padding: 0 32px; } }
.hero-dot {
  position: relative; padding: 8px 0 10px; min-width: 64px;
  background: none; border: 0; cursor: pointer;
  color: rgba(255, 255, 255, .6); font: 700 13px/1 var(--font-head); letter-spacing: .16em; text-align: left;
}
.hero-dot::before, .hero-dot::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; }
.hero-dot::before { right: 0; background: rgba(255, 255, 255, .25); }
.hero-dot::after { width: 0; background: #7fd6ee; }
.hero-dot.is-active { color: #fff; }
.hero.is-playing .hero-dot.is-active::after { animation: dot-progress var(--hero-interval) linear both; }
.hero:not(.is-playing) .hero-dot.is-active::after { width: 100%; }
@keyframes dot-progress { from { width: 0; } to { width: 100%; } }
.hero-dot:focus-visible { outline: 2px solid #7fd6ee; outline-offset: 4px; }
.hero-note { right: 16px; bottom: calc(5vw + 20px); }
@media (min-width: 768px) { .hero-note { right: 112px; } }

/* 下へ進む: 縦の線を点が流れる */
.scroll-cue {
  position: absolute; z-index: 3; right: 24px; bottom: calc(5vw + 8px);
  display: none; flex-direction: column; align-items: center; gap: 10px;
  color: #fff; text-decoration: none; font: 700 11px/1 var(--font-head); letter-spacing: .24em;
}
.scroll-cue span { writing-mode: vertical-rl; }
.scroll-cue::after {
  content: ""; width: 1px; height: 64px;
  background: linear-gradient(#fff, #fff) 0 0 / 1px 18px no-repeat, rgba(255, 255, 255, .3);
  animation: scroll-cue 2.2s ease-in-out infinite;
}
@keyframes scroll-cue { from { background-position: 0 -18px, 0 0; } to { background-position: 0 64px, 0 0; } }
@media (min-width: 768px) { .scroll-cue { display: flex; } }

/* ---------- 見出しを力強く ---------- */
.section-head h2 { font-size: clamp(28px, 6.4vw, 44px); }
.section-en { font-size: 13px; }

/* ---------- 写真の枠(クリップで現れ、中の写真はゆっくり縮み、視差で動く) ---------- */
.media { position: relative; margin: 0; overflow: hidden; background: var(--concrete); }
.media-frame { position: absolute; inset: 0; }
.media-frame img, .message-bg-frame img, .photo-bg-frame img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: translate3d(0, var(--py, 0px), 0) scale(1.14);
  will-change: transform;
}

/* ---------- 私たちについて: 文と写真の左右 ---------- */
.split { display: grid; gap: 32px; align-items: center; }
.split-media { aspect-ratio: 4 / 3; }
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; gap: 64px; }
  .split-media { aspect-ratio: 4 / 5; }
}

/* ---------- 代表挨拶: 写真の帯の上にカード ---------- */
.section-message { position: relative; overflow: hidden; }
.message-bg { position: absolute; left: 0; right: 0; top: 0; height: 420px; overflow: hidden; }
.message-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11, 35, 64, .55), rgba(238, 245, 248, 1));
}
.message-bg-frame { position: absolute; inset: 0; }
.section-message .wrap { position: relative; }
.section-message .section-head { color: #fff; }
.section-message .section-head .section-en { color: #dbf1f8; }
.section-message .message-card { position: relative; box-shadow: 0 24px 60px rgba(11, 35, 64, .16); }
.message-note { position: absolute; top: -40px; right: 16px; bottom: auto; }
@media (min-width: 768px) { .message-bg { height: 520px; } .message-note { right: 32px; } }

/* ---------- 大切にしていること: 大きな写真 ---------- */
.wide-media { aspect-ratio: 16 / 10; margin-bottom: 24px; }
@media (min-width: 768px) { .wide-media { aspect-ratio: 21 / 9; margin-bottom: 32px; } }

/* ---------- 事業内容: カードの上に写真 ---------- */
.service-media { aspect-ratio: 16 / 9; margin: -22px -18px 22px; }
@media (min-width: 768px) { .service-media { margin: -40px -40px 28px; } }
.service { overflow: hidden; }

/* ---------- 施工の流れ: 塗り壁の質感の背景と、写真 ---------- */
.section-texture {
  background:
    linear-gradient(rgba(255, 255, 255, .86), rgba(255, 255, 255, .86)),
    url("../img/texture-wall-800.webp") center / 400px repeat;
}
.flow-layout { display: grid; gap: 24px; }
.flow-media { aspect-ratio: 16 / 10; }
@media (min-width: 1000px) {
  .flow-layout { grid-template-columns: 5fr 7fr; gap: 40px; align-items: start; }
  .flow-media { aspect-ratio: 4 / 5; position: sticky; top: calc(var(--header-h) + 24px); }
  .flow-layout .flow { grid-template-columns: 1fr 1fr; }
}

/* ---------- 採用: 写真を全面の背景に ---------- */
.section-photo { position: relative; overflow: hidden; color: #fff; background: var(--ink); }
.photo-bg { position: absolute; inset: 0; }
.photo-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6, 22, 44, .9), rgba(6, 22, 44, .62)); }
.photo-bg-frame { position: absolute; inset: 0; }
.section-photo .wrap { position: relative; }
.section-photo .section-en { color: #7fd6ee; }
.section-photo .lead-heading { color: #fff; border-left-color: #7fd6ee; }
.section-photo .prose p { color: rgba(255, 255, 255, .88); }
.photo-note { right: 16px; bottom: -40px; }
@media (min-width: 768px) { .section-photo { padding: 140px 0; } .photo-note { right: 32px; bottom: -80px; } }

/* ---------- 写真の出どころ ---------- */
.photo-credit { margin: 16px 0 0 !important; font-size: 11px; line-height: 1.7; color: rgba(255, 255, 255, .5); }
.photo-credit a { color: rgba(255, 255, 255, .7); }

/* ---------- 画面に入ったら(visual.js が、まだ下にあるものだけ .reveal-pending にする) ---------- */
.reveal-pending { opacity: 0; transform: translateY(28px); }
.reveal-pending.is-in { opacity: 1; transform: none; transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
/* 写真は、幕が開くように現れ、中の写真がゆっくり縮む。
   幕(clip-path)は中の .media-frame に掛ける。見張っている figure 自身に掛けると、見える広さが 0 になり、
   IntersectionObserver が「画面に入った」と言わず、ずっと隠れたままになる */
.media.reveal-pending { opacity: 1; transform: none; }
.media.reveal-pending .media-frame { clip-path: inset(0 100% 0 0); }
.media.reveal-pending.is-in .media-frame { clip-path: inset(0 0 0 0); transition: clip-path 1.2s var(--ease-out); }
.media.reveal-pending .img-note { opacity: 0; }
.media.reveal-pending.is-in .img-note { opacity: 1; transition: opacity .4s ease .9s; }
.media.reveal-pending .media-frame img { transform: translate3d(0, var(--py, 0px), 0) scale(1.3); }
.media.reveal-pending.is-in .media-frame img { transform: translate3d(0, var(--py, 0px), 0) scale(1.14); transition: transform 1.8s var(--ease-out); }

/* ---------- 動きを減らす設定 ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-slide, .hero-line, .hero-line-block, .hero-slide.is-active .hero-img,
  .hero-dot::after, .scroll-cue::after { animation: none !important; transition: none !important; }
  .hero-img { transform: none; }
  .reveal-pending, .media.reveal-pending, .media.reveal-pending .media-frame, .media.reveal-pending .img-note { opacity: 1 !important; transform: none !important; clip-path: none !important; transition: none !important; }
  .media-frame img, .message-bg-frame img, .photo-bg-frame img { transform: none !important; }
  html { scroll-behavior: auto; }
}

/* 写真ごとの切り取りの位置(人や道具が写真の端にあるもの) */
#about .media-frame img { object-position: 82% 50%; }

/* ---------- 文字を軽く見せる(018 追記1・Aki様のご感想「ABOUT と代表挨拶が続くと文字が多すぎる」) ---------- */
/* ABOUT: 見出しと最初の文を大きく、残りは小さく薄く(文章は変えない) */
#about .prose .lead-heading { font-size: clamp(22px, 5.4vw, 30px); }
#about .prose .lead-heading + p { font-size: clamp(16px, 4.2vw, 18px); line-height: 1.95; color: var(--ink); margin-bottom: 1.4em; }
#about .prose .lead-heading + p ~ p { font-size: 14px; line-height: 1.9; color: var(--ink-soft); }

/* 代表挨拶: 最初の段落と署名だけを見せ、残りは「続きを読む」で開く(<details> なので JS が無くても開ける) */
.message-more { margin: 0 0 1.2em; }
.message-more > summary {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 6px 0; list-style: none;
  color: var(--accent); font-weight: 700; font-size: 14px; letter-spacing: .08em;
}
.message-more > summary::-webkit-details-marker { display: none; }
.message-more > summary::after {
  content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px;
  border: 1px solid currentColor; border-radius: 50%; font-size: 14px; line-height: 1;
}
.message-more[open] > summary::after { content: "−"; }
.message-more > summary:hover { color: var(--accent-deep); }
.message-more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.message-more .more-close { display: none; }
.message-more[open] .more-open { display: none; }
.message-more[open] .more-close { display: inline; }
.message-more[open] > summary { margin-top: .4em; order: 2; }
.message-more p { margin: 1.2em 0 0; }
.message-more[open] { display: flex; flex-direction: column; } /* 開いたら「閉じる」は本文の後に */
/* 見出しの最後の1〜2文字だけが次の行に落ちないように */
.lead-heading { text-wrap: balance; }
