/* =====================================================================
   modern テーマ: home.css — トップページ専用（Docs/redesign-proposal.md §5.1）
   読み込み: partials/top.ejs が / のときだけ読む（pages.css は読まないので、埋め込み .m-embed もここに持つ）。
   クラス: h-* = ホーム専用。m-* は base.css の共通部品（ここでは上書きしない）。
   ===================================================================== */

/* ---------- 共通: 3 列カード / モバイル横スクロール ---------- */
.h-grid-3 { display: grid; gap: var(--sp-5); grid-template-columns: 1fr; }
@media (min-width: 600px) { .h-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .h-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.h-card .m-card__media { aspect-ratio: 4 / 3; }
.h-card .m-card__media picture, .h-case__media picture { display: contents; }
.m-card__media img { display: block; }

/* お客様別: 600px 未満は横スクロール（scroll-snap）。はみ出しはこの要素の中だけ */
@media (max-width: 599.98px) {
  .h-scroller {
    display: grid; grid-auto-flow: column; grid-auto-columns: 82%; grid-template-columns: none; gap: var(--sp-4);
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
    margin-inline: calc(var(--gutter) * -1); padding: 0 var(--gutter) var(--sp-3);
    scrollbar-width: thin;
  }
  .h-scroller > * { scroll-snap-align: start; }
}

/* ---------- ① ヒーロー ---------- */
.h-hero { padding-block: var(--sp-5) 0; } /* 下の余白は次の区画の padding で取る */
.h-hero__inner { display: grid; gap: var(--sp-6); align-items: center; }
.h-hero__media { order: -1; margin-inline: calc(var(--gutter) * -1); }
.h-hero__media picture { display: contents; }
.h-hero__media img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.h-hero__title { font-size: var(--fs-h1); line-height: 1.4; margin-bottom: var(--sp-4); }
.h-hero__title span { display: inline-block; } /* 行の途中では折り返さない（読点で区切った 2 行） */
.h-hero__lead { color: #444; font-size: 17px; max-width: 34em; margin-bottom: var(--sp-5); }
.h-hero__actions { display: grid; gap: var(--sp-3); }
.h-hero__actions .m-btn { width: 100%; }
.h-hero__contact { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5); margin-top: var(--sp-5); }
.h-hero__contact p { margin: 0; }
.h-hero__note { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 4px 12px; border-radius: 999px; background: var(--c-brand-tint); color: var(--c-brand-dark); font-weight: 700; font-size: 15px; }
.h-hero__tel { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-3); }
.h-hero__tel a { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--c-ink); font-weight: 700; font-size: 22px; letter-spacing: .06em; text-decoration: none; }
.h-hero__tel a:hover { color: var(--c-brand); }
.h-hero__tel span { color: var(--c-muted); font-size: var(--fs-small); }
@media (min-width: 600px) {
  .h-hero__media { margin-inline: 0; }
  .h-hero__media img { border-radius: var(--radius); }
  .h-hero__actions { display: flex; flex-wrap: wrap; }
  .h-hero__actions .m-btn { width: auto; }
}
@media (min-width: 1024px) {
  .h-hero { padding-block: var(--sp-7) 0; }
  .h-hero__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--sp-8); }
  .h-hero__media { order: 0; }
}

/* 첫 화면 360° 투어 (home-tour.js) — 옛 사이트처럼 화면 폭 가득, 크게 */
.h-hero--tour { padding-top: 0; }
.h-tour { background: #1f1a16; }
.h-tour__frame { position: relative; height: min(72vh, 760px); min-height: 360px; overflow: hidden; background: #2b2b2b; }
.h-tour__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.h-tour__arrow {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%);
  display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.45); color: #fff; cursor: pointer; transition: background-color var(--t-fast);
}
.h-tour__arrow:hover { background: var(--c-brand); }
.h-tour__arrow:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.h-tour__arrow--prev { left: 12px; }
.h-tour__arrow--next { right: 12px; }
.h-tour__tabs {
  display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none;
  max-width: calc(var(--container) + var(--gutter) * 2); margin: 0 auto; padding: var(--sp-3) var(--gutter) 0;
}
.h-tour__tabs::-webkit-scrollbar { display: none; }
/* 버튼 줄을 가로 가운데로(2026-12-04 사용자 요청). 넘칠 때 왼쪽이 잘리지 않게 justify-content 대신 auto 여백 */
.h-tour__tabs { justify-content: center; }
.h-tour__step, .h-tour__dots { display: none; }
.h-tour__tab {
  flex: none; min-height: 44px; padding: 0 var(--sp-4); border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  background: transparent; color: #fff; font: inherit; font-size: 14px; cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.h-tour__tab:hover { border-color: #fff; }
.h-tour__tab[aria-pressed="true"] { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }
.h-tour__tab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.h-tour__hint { max-width: calc(var(--container) + var(--gutter) * 2); margin: 0 auto; text-align: center; padding: var(--sp-2) var(--gutter) var(--sp-3); color: rgba(255,255,255,.75); font-size: 13px; }
.h-hero--tour .h-hero__inner { padding-top: var(--sp-6); }
@media (max-width: 599px) {
  /* 휴대폰: 그림 아래 띠는 「‹ 사례 이름 ›」 한 줄 + 점. 그림 안 화살표는 숨긴다(2026-12-04) */
  .h-tour__arrow { display: none; }
  .h-tour__tabs { flex-wrap: nowrap; justify-content: space-between; align-items: center; gap: 0; overflow: visible; padding: 10px 8px 0; }
  .h-tour__tab { display: none; border: 0; background: transparent; min-height: 44px; padding: 0 8px; font-size: 15px; font-weight: 700; flex: 1; }
  .h-tour__tab[aria-pressed="true"] { display: block; background: transparent; color: #fff; }
  .h-tour__step { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: transparent; color: #fff; cursor: pointer; }
  .h-tour__step:active { background: var(--c-brand); border-color: var(--c-brand); }
  .h-tour__dots { display: flex; justify-content: center; gap: 6px; padding-top: 6px; }
  .h-tour__dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.35); transition: width var(--t-fast), background-color var(--t-fast); }
  .h-tour__dots span.is-active { width: 18px; border-radius: 3px; background: var(--c-brand); }
  .h-tour__hint { padding: 6px var(--gutter) 12px; font-size: 12px; }
  .h-hero--tour .h-hero__inner { padding-top: var(--sp-5); }
}
@media (min-width: 1024px) {
  .h-hero--tour { padding-top: 0; }
  /* PC: 소개 문구를 투어 위 왼쪽에 흰 글자로 겹친다(2026-12-04 사용자 요청).
     글자 영역 밖은 pointer-events: none 이라 투어를 그대로 끌어서 볼 수 있다. */
  .h-hero--tour { position: relative; }
  .h-hero--tour .h-tour__frame { min-height: 600px; }
  .h-hero--tour .h-tour__frame::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(90deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,.5) 32%, rgba(0,0,0,0) 58%);
  }
  .h-hero--tour .h-hero__inner {
    position: absolute; top: 0; left: 0; right: 0; height: max(min(72vh, 760px), 600px);
    display: flex; align-items: center; padding-block: var(--sp-6); pointer-events: none;
  }
  .h-hero--tour .h-hero__text { max-width: 560px; pointer-events: auto; color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,.45); }
  .h-hero--tour .m-eyebrow { color: #9fe0ae; }
  .h-hero--tour .h-hero__title { color: #fff; }
  .h-hero--tour .h-hero__lead { color: rgba(255,255,255,.92); }
  .h-hero--tour .m-btn { text-shadow: none; }
  .h-hero--tour .m-btn--outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.85); }
  .h-hero--tour .m-btn--outline:hover { background: rgba(255,255,255,.14); color: #fff; }
  .h-hero--tour .h-hero__note { text-shadow: none; }
  .h-hero--tour .h-hero__tel a { color: #fff; }
  .h-hero--tour .h-hero__tel a:hover { color: #9fe0ae; }
  .h-hero--tour .h-hero__tel span { color: rgba(255,255,255,.8); }
}

/* ---------- ③ サービス ---------- */
.h-services__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.h-services__grid > li { display: flex; min-width: 0; }
/* 공사 6개 + 상담 칸: 상담 칸을 2칸 폭으로 해서 2열(모바일)·4열(PC) 모두 빈칸 없이 채운다 */
.h-services__grid > li:last-child { grid-column: span 2; }
.h-svc {
  display: flex; flex-direction: column; width: 100%; background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius);
  overflow: hidden; color: inherit; text-decoration: none; transition: box-shadow var(--t-fast);
}
a.h-svc:hover { box-shadow: var(--shadow-hover); color: inherit; }
a.h-svc:hover .h-svc__title { color: var(--c-brand); }
.h-svc__media { aspect-ratio: 2 / 1; background: var(--c-bg-warm); overflow: hidden; }
.h-svc__media picture { display: contents; }
.h-svc__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.h-svc__body { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-3) var(--sp-3) var(--sp-4); flex: 1; }
.h-svc__title { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-1); margin: 0; font-size: 16px; line-height: 1.45; transition: color var(--t-fast); }
.h-svc__title .m-icon { color: var(--c-brand); }
.h-svc__text { display: none; margin: 0; color: var(--c-muted); font-size: 14px; line-height: 1.7; }
.h-svc--ask { justify-content: center; gap: var(--sp-2); padding: var(--sp-4); background: var(--c-brand-tint); border-color: transparent; }
.h-svc--ask .h-svc__text { display: block; }
.h-svc--ask .m-btn { align-self: flex-start; margin-top: var(--sp-2); }
@media (max-width: 599.98px) { .h-svc--ask .m-btn { align-self: stretch; padding-inline: 8px; font-size: 15px; white-space: nowrap; gap: 4px; } }
@media (min-width: 600px) {
  .h-services__grid { gap: var(--sp-4); }
  .h-svc__body { padding: var(--sp-4) var(--sp-4) var(--sp-5); }
  .h-svc__title { font-size: 17px; }
  .h-svc__text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (min-width: 1024px) {
  .h-services__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-5); }
  .h-svc--ask { padding: var(--sp-5); }
}

/* ---------- 埋め込み（360° ツアー・地図）: クリックで iframe（js/lazy-embed.js） ---------- */
.m-embed { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius); background: #2b2b2b; color: #fff; text-decoration: none; }
.m-embed > img, .m-embed > picture > img, .m-embed__thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.m-embed > picture { display: contents; }
.m-embed::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, .45)); pointer-events: none; transition: background-color var(--t-fast); }
.m-embed.is-loaded::after { content: none; }
.m-embed__btn {
  position: absolute; left: 50%; top: 50%; z-index: 1; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 48px; padding: 10px 22px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .95); color: var(--c-ink); font-weight: 700; font-size: 16px; line-height: 1.2; white-space: nowrap; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25); transition: background-color var(--t-fast), color var(--t-fast);
}
.m-embed__btn:hover, .m-embed:hover .m-embed__btn { background: var(--c-brand); color: #fff; }
.m-embed__play { color: var(--c-brand); font-size: 13px; }
.m-embed__btn:hover .m-embed__play, .m-embed:hover .m-embed__play { color: #fff; }
.m-embed.is-loaded { background: #000; }
.m-embed.is-loaded iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.m-embed__fallback { position: absolute; left: var(--sp-3); bottom: var(--sp-3); z-index: 1; color: #fff; }

/* ---------- ⑤ 施工事例 ---------- */
.h-case { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; }
.h-case__media { aspect-ratio: 3 / 2; border-radius: 0; }
.h-case__media:not(.m-embed) img { display: block; width: 100%; height: 100%; object-fit: cover; }
.h-case__body { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-4) var(--sp-5) var(--sp-5); flex: 1; }
.h-case__meta { margin: 0; color: var(--c-muted); font-size: var(--fs-small); }
.h-case__title { margin: 0; font-size: var(--fs-h4); }
.h-case__title a { color: var(--c-ink); text-decoration: none; }
.h-case__title a:hover { color: var(--c-brand); text-decoration: underline; }
.h-case__more { margin-top: auto; padding-top: var(--sp-2); }

/* ---------- ⑥ 大建の安心宣言 ---------- */
.h-anshin__grid { display: grid; gap: var(--sp-4); }
.h-anshin__item { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-4); align-items: start; padding: var(--sp-5); background: #fff; border-radius: var(--radius); }
.h-anshin__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--c-brand); color: #fff; }
.h-anshin__title { margin: 0 0 var(--sp-2); font-size: var(--fs-h4); color: var(--c-brand-dark); }
.h-anshin__item p { margin: 0; }
@media (min-width: 1024px) {
  .h-anshin__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
  .h-anshin__item { padding: var(--sp-6); }
}

/* ---------- ⑦ 施工の流れ（要約） ---------- */
.h-flow__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); counter-reset: none; }
.h-flow__step { display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) var(--sp-4); background: var(--c-bg-warm); border-radius: var(--radius); font-weight: 700; }
.h-flow__num { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--c-brand); color: #fff; font-size: 14px; letter-spacing: 0; }
@media (min-width: 600px) { .h-flow__list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); } }
@media (min-width: 1024px) {
  .h-flow__list { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--sp-4); }
  .h-flow__step { position: relative; flex-direction: column; justify-content: flex-start; text-align: center; padding: var(--sp-5) var(--sp-3); min-height: 132px; line-height: 1.5; }
  .h-flow__step:not(:last-child)::after {
    content: ""; position: absolute; right: calc(var(--sp-4) / -2 - 5px); top: 50%; width: 10px; height: 10px; z-index: 1;
    border-top: 2px solid var(--c-brand); border-right: 2px solid var(--c-brand); transform: translateY(-50%) rotate(45deg);
  }
}

/* ---------- ⑧ 会社案内 + 地図 ---------- */
.h-company__inner { display: grid; gap: var(--sp-6); align-items: start; }
.h-company .m-deflist { background: #fff; border-radius: var(--radius); padding: var(--sp-2) var(--sp-5); }
.h-company .m-deflist > div:last-child { border-bottom: 0; }
@media (max-width: 599.98px) { .h-company .m-deflist > div { grid-template-columns: 1fr; gap: 0; } }
.h-company__map .m-embed { aspect-ratio: 4 / 3; }
@media (min-width: 1024px) {
  .h-company__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-8); align-items: center; }
}

/* 좁은 PC(1024–1279px)에서는 글자가 왼쪽 화살표와 겹치지 않게 조금 띄운다 */
@media (min-width: 1024px) and (max-width: 1279px) {
  .h-hero--tour .h-hero__inner { padding-inline-start: 76px; }
}

/* 휴대폰·태블릿(<1024px): PC처럼 소개 문구(eyebrow·제목·소개문)를 투어 그림 위에 작은 흰 글자로 겹친다.
   버튼·전화번호는 그림 아래. 문구는 pointer-events: none 이라 그 위에서도 투어를 끌어 볼 수 있다(2026-12-04 사용자 요청). */
@media (max-width: 1023px) {
  .h-hero--tour { position: relative; --tour-h: clamp(360px, 60vh, 560px); }
  .h-hero--tour .h-tour__frame { height: var(--tour-h); max-height: none; min-height: 0; }
  .h-hero--tour .h-tour__frame::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(0deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.5) 35%, rgba(0,0,0,0) 65%);
  }
  .h-hero--tour .h-hero__copy {
    position: absolute; top: 0; left: 0; right: 0; height: var(--tour-h); z-index: 1;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 0 var(--gutter) 24px; /* 휴대폰은 그림 안 버튼이 없으므로 문구를 아래쪽에 정돈해 둔다 */
    color: #fff; text-shadow: 0 1px 10px rgba(0,0,0,.5); pointer-events: none;
  }
  .h-hero--tour .h-hero__copy .m-eyebrow { color: #9fe0ae; font-size: 12px; margin-bottom: 8px; }
  .h-hero--tour .h-hero__copy .h-hero__title { color: #fff; font-size: 26px; line-height: 1.38; letter-spacing: .02em; margin-bottom: 12px; }
  .h-hero--tour .h-hero__copy .h-hero__lead { color: rgba(255,255,255,.9); font-size: 13px; line-height: 1.75; margin-bottom: 0; max-width: 32em; }
  .h-hero--tour .h-tour__arrow { top: auto; bottom: 76px; transform: none; } /* 뷰어 조작 버튼 바로 위 */
  .h-hero--tour .h-hero__inner { padding-top: var(--sp-4); }
}
@media (min-width: 600px) and (max-width: 1023px) {
  /* 태블릿: 그림 안에 뷰어 조작 버튼이 있으므로 문구는 그 위, 화살표는 세로 가운데 양 끝 */
  .h-hero--tour .h-hero__copy { padding: 0 76px 72px; }
  .h-hero--tour .h-tour__arrow { top: 50%; bottom: auto; transform: translateY(-50%); }
  .h-hero--tour .h-hero__copy .h-hero__title { font-size: 30px; }
  .h-hero--tour .h-hero__copy .h-hero__lead { font-size: 15px; }
}

/* 위지윅 본문(관리 화면 「홈 화면」, 2026-12-04~): 히어로 아래 본문 폭은 서비스 페이지 본문과 비슷하게 */
.h-body__inner { max-width: 880px; margin-inline: auto; }
.h-body__inner > h2:first-child { margin-top: 0; }
