/* ===================================================================
   COMMON CSS - 全ページ共通 (index.html / map/index.html / 403.html)
   ★各ページ固有のCSSより先に読み込むこと
   =================================================================== */

:root {
  --misawa-blue: #0081cc;
  --mid-blue: #38669b;
  --light-blue-gray: #c7d4e0;
  --dark-navy: #1d293c;
  --bg-white: #ffffff;
  --bg-light: #f0f6fb;
  --text-dark: #1d293c;
  --text-mid: #38669b;
  --text-light: #6a8caa;
  --font-display: "Shippori Mincho", serif;
  --font-body: "Zen Kaku Gothic New", sans-serif;
  --font-en: "Bebas Neue", sans-serif;
  --max-w: 1200px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* footer部分はサーバー担当がミサワホーム共通フッターを
   アップロード時に組み込むため、上記のグローバルリセット
   (box-sizing / margin / padding の初期化)を効かせないよう
   ブラウザ標準の挙動に戻しておく。
   ★共通フッター側のCSSが前提とするデフォルトスタイルと
     競合しないようにするための措置。 */

footer,
footer *,
footer *::before,
footer *::after {
  all: revert;
}

/* スムーススクロールは「動きを減らす」設定でない場合のみ */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* 「動きを減らす」設定：モバイルメニュー項目の上からのスライドを止める（フェードは残す） */
@media (prefers-reduced-motion: reduce) {
  .mobile-menu-item {
    transform: none;
  }
}

/* 固定ヘッダーの下にアンカー先の見出しが隠れないようにする。
   --header-h はcommon.jsでヘッダーの実測高さから算出している */
section[id] {
  scroll-margin-top: var(--header-h, 96px);
}

body {
  font-family: var(--font-body);
  font-weight: 500;
  background: var(--bg-white);
  color: var(--text-dark);
  overflow-x: hidden;
}

#cursor {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--misawa-blue);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition:
    transform 0.08s ease,
    width 0.2s ease,
    height 0.2s ease,
    opacity 0.2s ease;
}

#cursor-ring {
  position: fixed;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--misawa-blue);
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition:
    transform 0.18s ease,
    width 0.2s ease,
    height 0.2s ease,
    opacity 0.2s ease;
  opacity: 0.4;
}
/* カスタムカーソルはマウス等の精密なポインタ環境でだけ有効にする。
   ★common.jsの判定 matchMedia("(pointer: fine)") と必ず同じ条件にすること */
#cursor,
#cursor-ring {
  display: none;
}

@media (pointer: fine) {
  /* UAスタイル（aのpointer）や各要素の個別指定より確実に優先させるため!importantを使う */
  body,
  body * {
    cursor: none !important;
  }

  #cursor,
  #cursor-ring {
    display: block;
  }
}

/* ─── ヘッダー（初期は透明、スクロール or ホバーで白背景） ─── */

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0.4rem 0;
  background: transparent;
  border-top: none;
  border-bottom: 1px solid transparent;
  box-shadow: none;
  transition:
    background 0.3s ease,
    border-bottom 0.3s ease,
    box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  --header-fg: #ffffff;
}

header.scrolled {
  background: #ffffff;
  border-bottom: 1px solid rgba(29, 41, 60, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --header-fg: var(--text-dark);
}

/* --- top utility row: desktop only, links out to the MISAWA corporate site --- */

.header-top {
  width: 100%;
}

.header-top-inner {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 8px clamp(1rem, 3vw, 2.5rem) 2px;
}

.util-list {
  display: flex;
  list-style: none;
  gap: 24px;
}

.util-list a {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--header-fg);
  text-decoration: none;
  white-space: nowrap;
  padding: 2px 0;
  transition: color 0.2s;
}

.util-list a svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
}

.header-logo-slot {
  position: absolute;
  inset: 0;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 2;
}

.header-logo-slot .logo {
  pointer-events: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-link {
  display: contents;
  text-decoration: none;
  color: inherit;
}

.logo-brand {
  display: inline-flex;
  align-items: center;
  color: var(--misawa-blue);
  line-height: 1;
  padding-left: 0.5rem;
}

.logo-brand img {
  display: block;
  height: 44px;
  width: auto;
}

.logo-text-ja {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.14em;
  margin-left: 1rem;
  color: var(--header-fg);
  white-space: nowrap;
  transition: color 0.2s;
}

/* --- main row: global nav (mega menu not used on this microsite) --- */

.header-inner {
  width: 100%;
  max-width: 100%;
  margin: 1px auto 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 clamp(1rem, 3vw, 2.5rem) 0;
  gap: 24px;
}

.primary-nav {
  margin-right: -18px;
}

.primary-nav ul {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0;
}

/* 各リンクの幅(width)はページごとの項目数・文字数に合わせてページ固有CSSで指定 */
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 10px 5px;
  color: var(--header-fg);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 2px;
  position: relative;
  transition: color 0.2s;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -0.4rem;
  height: 2px;
  background: var(--misawa-blue);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s ease;
}

.nav-link:hover::after {
  transform: scaleX(1);
}

/* --- 画面が狭まりロゴとnaviが重なる手前で、両方を一段階縮小する --- */
@media (max-width: 1150px) and (min-width: 901px) {
  .logo-text-ja {
    font-size: 15px;
  }

  .logo-brand img {
    height: 36px;
  }

  .nav-link {
    font-size: 14px;
    padding: 8px 10px;
  }
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 101;
}

.hamburger span {
  display: block;
  width: 28px;
  height: 2px;
  background: var(--header-fg);
  transition:
    background 0.25s ease,
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease,
    width 0.3s ease;
  transform-origin: center;
}

/* メニューを開くとハンバーガー自体が✕に変形し、閉じるボタンを兼ねる */
.hamburger.open span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
  width: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ─── モバイルメニュー ─── */

.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: linear-gradient(
    160deg,
    rgba(6, 22, 52, 0.97) 0%,
    rgba(12, 48, 100, 0.95) 50%,
    rgba(20, 70, 130, 0.97) 100%
  );
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  flex-direction: column;
  align-items: center;
  /* 中身が画面に収まらないとき（横向きスマホ等）にスクロールできるようにする。
     justify-content:center のままだと、はみ出した上端がスクロールでも
     届かない位置に切れてしまうため flex-start にし、
     下の margin:auto で「収まるときだけ中央寄せ」を再現する */
  justify-content: flex-start;
  gap: 0;
  overflow-x: hidden;
  overflow-y: auto;
  /* メニュー内のスクロールが背面のページに伝わらないようにする */
  overscroll-behavior: contain;
  /* 上はヘッダー（✕ボタン）と重ならないよう実測高さぶん空ける */
  padding: calc(var(--header-h, 64px) + 1rem) 0 2rem;
}

/* 収まるときは上下の余白を均等に分け合って中央寄せ、
   収まらないときは余白0になり上から順に並ぶ */
.mobile-menu > :first-child {
  margin-top: auto;
}

.mobile-menu > :last-child {
  margin-bottom: auto;
}

.mobile-menu::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      105deg,
      transparent 30%,
      rgba(126, 200, 227, 0.04) 50%,
      transparent 70%
    ),
    linear-gradient(
      75deg,
      transparent 20%,
      rgba(180, 220, 255, 0.03) 45%,
      transparent 65%
    );
  pointer-events: none;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu-item {
  width: 100%;
  display: flex;
  justify-content: center;
  opacity: 0;
  transform: translateY(-18px);
  transition:
    opacity 0.45s ease,
    transform 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
  border-bottom: 1px solid rgba(126, 200, 227, 0.12);
  position: relative;
}

.mobile-menu-item:first-of-type {
  border-top: 1px solid rgba(126, 200, 227, 0.12);
}

.mobile-menu-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(126, 200, 227, 0.6),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-menu-item:hover::before {
  opacity: 1;
}

.mobile-menu.open .mobile-menu-item {
  opacity: 1;
  transform: translateY(0);
}

.mobile-menu.open .mobile-menu-item:nth-child(1) {
  transition-delay: 0.06s;
}

.mobile-menu.open .mobile-menu-item:nth-child(2) {
  transition-delay: 0.12s;
}

.mobile-menu.open .mobile-menu-item:nth-child(3) {
  transition-delay: 0.18s;
}

.mobile-menu.open .mobile-menu-item:nth-child(4) {
  transition-delay: 0.24s;
}

.mobile-menu.open .mobile-menu-item:nth-child(5) {
  transition-delay: 0.3s;
}

.mobile-menu.open .mobile-menu-item:nth-child(6) {
  transition-delay: 0.36s;
}

.mobile-menu a {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  color: rgba(210, 235, 250, 0.9);
  text-decoration: none;
  letter-spacing: 0.18em;
  padding: 1.3rem 2rem;
  width: 100%;
  text-align: center;
  transition:
    color 0.25s,
    text-shadow 0.25s;
}

.mobile-menu a:hover {
  color: #fff;
  text-shadow:
    0 0 20px rgba(126, 200, 227, 0.8),
    0 0 40px rgba(126, 200, 227, 0.3);
}

/* --- mobile menu: secondary group (external MISAWA links), set apart
       from the main in-page nav above with extra space (no border) --- */
.mobile-menu-subnav {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.75rem;
}

.mobile-menu-subnav .mobile-menu-item {
  border-top: none;
  border-bottom: none;
}

.mobile-menu a.mobile-menu-link--sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: clamp(0.75rem, 3vw, 0.85rem);
  letter-spacing: 0.08em;
  padding: 0.85rem 2rem;
}

.mobile-menu-link--sub svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: currentColor;
}

@keyframes scrollPulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scaleY(1);
  }
  50% {
    opacity: 1;
    transform: scaleY(1.2);
  }
}

/* ─── セクション間 画像ディバイダー ─── */

.section-divider {
  position: relative;
  z-index: 5; /* 上のセクションより前面に被せる */
  line-height: 0; /* img下の余白を除去 */
  pointer-events: none; /* 装飾画像が下の要素の操作を妨げないように */
}

.section-divider picture {
  display: block;
}

.section-divider img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: -1px; /* 画像高さの端数丸めで次要素との間に出る1pxの隙間を除去 */
}

/* footer直前のdivider(divider_01.avif)は最下段1pxに半透明のグレーの縁が
   焼き込まれているため、CSSでその行を切り落として線を見えなくする */

.footer-divider img {
  clip-path: inset(0 0 3% 0);
}

/* PC: 上のセクションへ食い込む量。画面幅に応じて -36〜-72px */

.section-divider.bite-up {
  margin-top: clamp(-72px, -6vw, -36px);
}

@media (max-width: 600px) {
  .section-divider.bite-up {
    margin-top: -24px;
  }

  /* footer手前のdividerはスマホだけ独立。共通の-24pxだと上がりすぎるので浅めに。
     ★スマホでの食い込み量はこの値で調整（0に近いほど下=境界寄り） */
  .section-divider.bite-up-deep {
    margin-top: -25px;
  }
}

@media (min-width: 601px) {
  .section-divider.bite-up-deep {
    margin-top: max(-56px, -3.8vw);
  }
}

section {
  position: relative;
  z-index: 2;
}

/* ─── サイトマップ（フッター直前） ─── */

#site-map {
  background: #acc1d2;
  border-top: none;
  padding: clamp(2.5rem, 5vw, 3.5rem) clamp(1.5rem, 5vw, 3rem) 1.8rem;
}

.site-map-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.site-map-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
  margin-bottom: 1.8rem;
}

.site-map-brand-name {
  font-family: var(--font-display);
  font-size: clamp(20px, 5vw, 30px);
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: 0.16em;
  display: block;
  margin-bottom: 1rem;
}

.site-map-tagline {
  font-size: 19px;
  color: var(--text-dark);
  line-height: 2;
  font-weight: 500;
  letter-spacing: 0.05em;
  max-width: 420px;
}

.site-map-col-title {
  font-family: var(--font-en);
  font-size: 12px;
  letter-spacing: 0.38em;
  color: var(--bg-white);
  margin-bottom: 1.1rem;
}

.site-map-links {
  list-style: none;
}

.site-map-links li {
  margin-bottom: 0.65rem;
}

.site-map-links a {
  font-size: 16px;
  color: var(--text-dark);
  text-decoration: none;
  letter-spacing: 0.08em;
  font-weight: 500;
  transition: color 0.2s;
}

.site-map-links a:hover {
  color: var(--misawa-blue);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .hamburger {
    display: flex;
  }

  .header-top {
    display: none !important;
  }

  .primary-nav {
    display: none !important;
  }

  .header-inner {
    padding: 12px clamp(1rem, 3vw, 2.5rem);
  }

  .logo-brand img {
    height: 34px;
  }

  header.scrolled .hamburger span {
    background: var(--misawa-blue);
  }

  .site-map-top {
    flex-direction: column;
    gap: 2rem;
  }
}

@media (max-width: 600px) {
  .site-map-top {
    align-items: center;
    text-align: center;
  }
}

footer {
  background-color: #fff;
}
