/* =========================================================
   株式会社Co Creation トップページの3D（2026-12-05）
   代表が選んだ案A「結ぶ」を、提案資料/HPアップデート3案 の試作（assets/proto.css と pattern-a/pattern.css）から移した。
   css/style.css の後に、トップページ（index.html と、英語の en/index.html）だけで読み込む。英語の文字の調整は最後の欄。
   ・事業案内の「3つの入口」（.x-doors）
   ・CGの注記（.x-cgnote）
   ・スクロールに合わせて3D・CGが動く枠（.x-story / .x-stage / .x-step / .x-card）と、文字のリンク（.x-link）
   ・各社の仕事の3D模型の名札（.w3-。js/top3d/works3d.js が作る）
   ・3Dの舞台、グループの輪の名札、冒頭、グループのつながり（.xa-。js/top3d/network3d.js・top.js）
   色は style.css の変数（--m- で始まるもの）だけを使う。銅色は目印だけ（ボタン・リンクには使わない）
   ========================================================= */

/* ---------- 事業案内の「3つの入口」：3本柱を、すべらせずに一度に見せる ---------- */
.x-doors { position: relative; z-index: 2; padding: clamp(3.5rem, 7vw, 6rem) 0; background: #fff; }
.x-doors .head { margin-bottom: 1.25rem; }
.x-doors .head__en { font-size: clamp(2.25rem, 1.5rem + 3vw, 4rem); }
.x-doors__lead { max-width: 40rem; margin-bottom: 2rem; color: var(--m-muted); }
.x-doors__list { display: grid; gap: 0.875rem; margin: 0; padding: 0; list-style: none; }
.x-door a {
  position: relative; display: grid; grid-template-columns: 6rem 1fr; gap: 1rem; align-items: center; height: 100%;
  padding: 0.75rem 3.75rem 0.75rem 0.75rem; border: 1px solid var(--m-line); border-radius: 20px;
  background: #fff; color: var(--m-ink); text-decoration: none;
  box-shadow: 0 24px 44px -36px rgba(15, 23, 42, 0.45);
  transition: transform 0.35s var(--m-ease), box-shadow 0.35s var(--m-ease), border-color 0.35s ease;
}
.x-door a:hover { transform: translateY(-4px); border-color: rgba(30, 64, 175, 0.35); box-shadow: 0 34px 54px -34px rgba(15, 42, 134, 0.5); }
.x-door__img { display: block; overflow: hidden; aspect-ratio: 1; border-radius: 14px; background: var(--m-base); }
.x-door__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--m-ease); }
.x-door a:hover .x-door__img img { transform: scale(1.05); }
.x-door__body { display: block; min-width: 0; }
.x-door__num { display: block; font-family: var(--m-en); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.14em; color: var(--m-copper-text); }
.x-door__name { display: block; margin: 0.15rem 0 0.25rem; font-family: var(--m-mincho); font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem); line-height: 1.45; letter-spacing: 0.04em; }
.x-door__text { display: block; color: var(--m-muted); font-size: 0.8125rem; line-height: 1.75; }
.x-door__arrow { position: absolute; right: 1rem; top: 50%; width: 2.25rem; height: 2.25rem; margin-top: -1.125rem; border-radius: 50%; background: var(--m-brand); color: #fff; transition: transform 0.3s var(--m-ease); }
.x-door__arrow::before { content: ""; position: absolute; left: 50%; top: 50%; width: 0.45rem; height: 0.45rem; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: translate(-65%, -50%) rotate(45deg); }
.x-door a:hover .x-door__arrow { transform: translateX(3px); }
@media (max-width: 420px) { .x-door__text { display: none; } .x-door a { grid-template-columns: 4.75rem 1fr; } }
@media (min-width: 900px) {
  .x-doors__list { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
  .x-door a { grid-template-columns: 1fr; align-items: start; padding: 0.75rem 0.75rem 1.5rem; }
  .x-door__img { aspect-ratio: 16 / 10; }
  .x-door__body { padding: 0.5rem 3.5rem 0 0.75rem; }
  .x-door__arrow { top: auto; bottom: 1.25rem; margin-top: 0; }
}

/* ---------- CGの注記 ---------- */
.x-cgnote {
  position: absolute; right: 0.875rem; bottom: 0.875rem; z-index: 3; margin: 0;
  padding: 0.15rem 0.7rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.86); color: var(--m-muted);
  font-size: 0.6875rem; line-height: 1.7; letter-spacing: 0.06em; pointer-events: none;
}
.x-cgnote--dark { background: rgba(6, 14, 48, 0.55); color: rgba(255, 255, 255, 0.85); }

/* ---------- スクロールに合わせて3D・CGが動く枠 ----------
   .x-stage は画面に貼りついたまま（sticky）。その上を、文章（.x-step）が流れていく */
.x-story { position: relative; isolation: isolate; overflow: clip; }   /* 物語が終わったら、貼りついた舞台も次の段落の下に隠す */
.x-stage {
  position: sticky; top: 0; z-index: 0;
  height: 100vh; height: 100svh; margin-bottom: -100vh; margin-bottom: -100svh;
  overflow: hidden;
}
.x-stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.x-story > :not(.x-stage) { position: relative; z-index: 1; }
.x-step { display: flex; align-items: center; min-height: 100vh; min-height: 100svh; padding: calc(var(--m-hd) + 2rem) 0 3rem; }
.x-step > .wrap { width: 100%; }
/* 縦長の画面（スマホと、タブレットを縦に持ったとき。XProto.portrait() と同じ条件）：CGは上、文章のカードは下 */
@media (max-width: 767px), (max-width: 1199px) and (max-aspect-ratio: 9/10) {
  .x-step { align-items: flex-end; padding-bottom: 4rem; }
}
@media (max-width: 767px) {
  .x-step { padding-bottom: 6.5rem; }   /* スマホは画面の下に「電話する」「お問い合わせ」があるため */
}
.x-card { width: min(100%, 32rem); padding: clamp(1.5rem, 3vw, 2.25rem); border-radius: 24px; }
.x-card > :last-child { margin-bottom: 0; }
.x-card--dark {
  background: rgba(7, 16, 52, 0.62); color: #fff; border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 40px 80px -50px rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.x-card__en { margin: 0 0 0.25rem; font-family: var(--m-en); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.18em; }
.x-card--dark .x-card__en { color: var(--m-copper-light); }
.x-card__title { margin: 0 0 1rem; font-family: var(--m-mincho); font-weight: 700; font-size: clamp(1.375rem, 1.1rem + 1.1vw, 1.875rem); line-height: 1.5; letter-spacing: 0.05em; color: inherit; }
.x-card p { font-size: 0.9375rem; line-height: 1.95; }
.x-card--dark p { color: rgba(255, 255, 255, 0.86); }
.x-card__meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin: 0 0 1.25rem; padding: 0; list-style: none; font-size: 0.8125rem; }
.x-card__meta b { margin-right: 0.5rem; font-weight: 500; opacity: 0.7; }
.x-card__links { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; margin-top: 1.5rem; }

/* ---------- 文字のリンク（ボタンの横に置く、控えめなリンク） ---------- */
.x-link {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.75rem;
  color: var(--m-blue); font-weight: 700; font-size: 0.9375rem;
  text-decoration: underline; text-decoration-color: rgba(30, 64, 175, 0.35); text-underline-offset: 0.4em;
}
.x-link:hover { text-decoration-color: currentColor; }
.x-link--light { color: #fff; text-decoration-color: rgba(255, 255, 255, 0.5); }
.x-link .icon-external { width: 0.875rem; height: 0.875rem; }

@media (prefers-reduced-motion: reduce) {
  .x-door a, .x-door__img img, .x-door__arrow { transition: none; }
  .x-door a:hover { transform: none; }
}

/* ---------- 各社の仕事の3D模型（js/top3d/works3d.js）：模型の中の名札。2026-12-04 追加 ----------
   銅色は名札の点（目印）だけ。名札は画面に出すだけで、読み上げは本文で行う */
.w3-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.w3-canvas--fixed { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.w3-labels { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.w3-lb { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; transition: opacity 0.25s linear; }
.w3-lb > i { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--m-copper); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9); }
.w3-lb > span {
  position: absolute; left: 9px; bottom: 9px; display: grid; gap: 0.05rem; white-space: nowrap;
  padding: 0.3rem 0.7rem 0.32rem; border-radius: 10px;
  background: rgba(255, 255, 255, 0.95); color: var(--m-ink);
  box-shadow: 0 10px 28px -14px rgba(15, 42, 134, 0.55);
}
.w3-lb strong { font-size: 0.8125rem; font-weight: 700; line-height: 1.45; letter-spacing: 0.04em; }
.w3-lb small { font-size: 0.6875rem; font-weight: 500; line-height: 1.45; letter-spacing: 0.02em; color: var(--m-muted); }
.w3-lb.is-left > span { left: auto; right: 9px; }
.w3-lb.is-below > span { bottom: auto; top: 9px; }
.w3-lb--year > span { padding: 0.22rem 0.62rem 0.26rem; background: var(--m-navy); color: #fff; }
.w3-lb--year strong { font-family: var(--m-en); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.08em; line-height: 1.3; }
.w3-lb--year small { color: rgba(255, 255, 255, 0.82); }
@media (max-width: 767px) {
  .w3-lb > span { padding: 0.2rem 0.5rem 0.22rem; border-radius: 8px; }
  .w3-lb strong { font-size: 0.75rem; }
  .w3-lb small { display: none; }                              /* スマホは主な言葉だけ（細かい説明は下の文章のカードで） */
  .w3-lb--year small { display: block; font-size: 0.625rem; }
  .w3-lb > i { width: 8px; height: 8px; left: -4px; top: -4px; }
}
@media (prefers-reduced-motion: reduce) { .w3-lb { transition: none; } }

/* =========================================================
   案A「結ぶ」：グループの輪を3Dに（試作は pattern-a/pattern.css）
   冒頭から「グループのつながり」まで、同じ3Dの輪（js/top3d/network3d.js）が画面の後ろに貼りついたまま続く
   ========================================================= */

/* ---------- 3Dの舞台：会社の色の、明るめの青の面（代表のご希望で 2026-12-04 に夜空のような紺から変更） ---------- */
.xa-stage { background: radial-gradient(125% 100% at 70% 34%, #4b8fe6 0%, #2d68d0 34%, #2254b9 66%, #1c47a3 100%); }
.xa-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(55% 50% at 72% 36%, rgba(125, 211, 252, 0.22), rgba(125, 211, 252, 0) 70%);
}
.xa-canvas { opacity: 0; transition: opacity 1.6s ease; }
.xa-stage.is-ready .xa-canvas { opacity: calc(1 - var(--xa-w, 0)); }
.xa-stage.is-run .xa-canvas { transition: none; }              /* 現れ終わったら、輪と模型の入れ替わりは読む位置どおりに */

/* ---------- 各社の仕事の3D模型（js/top3d/works3d.js。2026-12-04 代表のご要望で追加） ----------
   各社の記事のあいだ（--xa-w が 1 に近いとき）は、輪の代わりにその会社の模型を見せる。値は js/top3d/top.js が決める */
.xa-works { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: var(--xa-w, 0); }
.xa-works.is-fallback { display: none; }
.xa-labels { opacity: calc(1 - var(--xa-w, 0)); }
.xa-cgnote { opacity: var(--xa-w, 0); }
@media (max-width: 767px), (max-width: 1199px) and (max-aspect-ratio: 9/10) {
  .xa-cgnote { top: calc(var(--m-hd) + 0.5rem); bottom: auto; }  /* 縦長の画面は、文章のカードが下にあるので上に */
}

/* 3Dの中の名札（画面に出すだけ。読み上げは本文のカードで） */
.xa-labels { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.xa-lb { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; }
.xa-lb > span {
  position: absolute; left: calc(var(--r, 12px) + 0.5rem); top: 0; transform: translateY(-50%);
  display: grid; gap: 0.05rem; white-space: nowrap;
  padding: 0.3rem 0.7rem; border-radius: 10px;
  background: rgba(12, 34, 104, 0.45); border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}
.xa-lb small { font-size: 0.625rem; font-weight: 700; letter-spacing: 0.16em; line-height: 1.5; color: var(--m-copper-light); }
.xa-lb strong { font-size: 0.8125rem; font-weight: 700; line-height: 1.5; letter-spacing: 0.04em; color: #fff; }
.xa-lb.is-focus > span { background: rgba(255, 255, 255, 0.96); border-color: #fff; }
.xa-lb.is-focus strong { color: var(--m-navy); }
.xa-lb.is-focus small { color: var(--m-copper-text); }
.xa-lb--core > span { left: 0; top: calc(var(--r, 30px) + 0.5rem); transform: translateX(-50%); justify-items: center; text-align: center; }
.xa-lb.is-left > span { left: auto; right: calc(var(--r, 12px) + 0.5rem); justify-items: end; text-align: right; }
.xa-lb--sub > span { padding: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
.xa-lb--sub small { color: rgba(191, 219, 254, 0.8); font-weight: 500; }
@media (max-width: 767px), (max-width: 1199px) and (max-aspect-ratio: 9/10) {
  .xa-labels { transition: opacity 0.5s ease; }
  .xa-stage.is-hero .xa-labels { opacity: 0; }
}
@media (max-width: 767px) {
  .xa-lb > span { padding: 0.2rem 0.5rem; }
  .xa-lb strong { font-size: 0.75rem; }
  .xa-lb--sub { display: none; }
}

/* 3Dが動かない環境 */
.xa-fallback { display: none; position: absolute; left: 50%; top: 50%; width: min(86vmin, 640px); height: auto; transform: translate(-30%, -50%); opacity: 0.55; }
.xa-stage.is-fallback .xa-fallback { display: block; }
.xa-stage.is-fallback .xa-labels { display: none; }
@media (max-width: 767px), (max-width: 1199px) and (max-aspect-ratio: 9/10) { .xa-fallback { transform: translate(-50%, -75%); } }

/* ---------- 冒頭 ---------- */
.xa-hero::after {
  background:
    linear-gradient(to top, rgba(4, 10, 36, 0.8) 0%, rgba(4, 10, 36, 0) 46%),
    linear-gradient(to right, rgba(4, 10, 36, 0.5) 0%, rgba(4, 10, 36, 0) 55%);
}
.xa-hero__btns { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.75rem; }
/* 見出しは3行（ものづくりの／未来を、／共に創る。）。ノートパソコンの幅（1280・1366・1536px など）で、
   右の輪の名札（株式会社速星精工）と重ならないように（2026-12-04。案Dと同じ行の分け方）。縦長の画面は今のまま */
@media (min-width: 1200px), (min-width: 768px) and (min-aspect-ratio: 901/1000) {
  .xa-hero .kv__title { max-width: 8em; }
  /* 背の低い画面（1024×600 など）でも、見出しが上部メニューの下に潜らないように */
  .xa-hero { padding-top: calc(var(--m-hd) + 2rem); }
}
/* 横にしたスマホなど、背がとても低い画面：冒頭では名札を出さない（見出しと重ならないように） */
@media (min-width: 768px) and (max-height: 520px) { .xa-stage.is-hero .xa-labels { opacity: 0; } }

/* ---------- グループのつながり ---------- */
.xa-steps { color: #fff; }
.xa-steps__head { padding-top: clamp(6rem, 12vw, 10rem); padding-bottom: 2rem; }
.xa-steps__lead { max-width: 34rem; color: rgba(255, 255, 255, 0.84); }
.xa-steps__hint { display: inline-flex; align-items: center; gap: 0.6rem; margin-top: 1.5rem; font-size: 0.8125rem; letter-spacing: 0.08em; color: rgba(191, 219, 254, 0.85); }
.xa-steps__hint::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; border: 2px solid var(--m-copper-light); }
.xa-step--end { min-height: 115vh; min-height: 115svh; }
.xa-step .x-card__links .btn { margin-top: 0.25rem; }
@media (min-width: 1024px) {
  .xa-step .x-card { margin-left: 0; }
}
/* 縦長の画面：3Dは画面の上に出るので、見出しの文章が上へ流れきってから、最初の模型が現れるように間を空ける
   （文章の上に名札や模型が重ならないように。2026-12-05 本番に移すときに追加） */
@media (max-width: 767px), (max-width: 1199px) and (max-aspect-ratio: 9/10) {
  .xa-steps__head { padding-bottom: 40vh; padding-bottom: 40svh; }
}
@media (max-width: 767px) {
  .xa-steps__head { padding-top: 5rem; }
  .xa-step .x-card { padding: 1.25rem 1.25rem 1.5rem; }
  .xa-step .x-card p { font-size: 0.875rem; line-height: 1.85; }
}

/* 冒頭のすぐ下の「3つの入口」は白い面（3Dの舞台を隠す） */
.xa-story .x-doors { border-radius: 28px; margin: 0 clamp(0.5rem, 1.5vw, 1.25rem); }

/* 明るめの青の面に合わせて、文章の札も少し明るいガラスに */
.xa-story .x-card--dark { background: rgba(14, 38, 112, 0.5); border-color: rgba(255, 255, 255, 0.22); }

/* 青い面の上では、キーボード操作の枠線を白に（会社の色の青の枠線は、青い面では見えにくいため。2026-12-05） */
.xa-hero :focus-visible, .xa-steps :focus-visible { outline-color: #fff; }
.xa-hero .topics :focus-visible { outline-color: var(--accent); }   /* 右下のお知らせは白い面なので、青のまま */

/* ---------- 英語のページ（en/index.html）の文字の調整（2026-12-05） ----------
   日本語用の広い字間を詰め、欧文に合う行間にする（style.css の「英語のページ（/en/）の文字の調整」と同じ考え方） */
html[lang="en"] .x-door__name { line-height: 1.3; letter-spacing: 0.01em; }
html[lang="en"] .x-card__title { line-height: 1.3; letter-spacing: 0.01em; }
html[lang="en"] .x-card p { line-height: 1.75; }
html[lang="en"] :is(.x-cgnote, .xa-steps__hint) { letter-spacing: 0.02em; }
html[lang="en"] .xa-lb small { letter-spacing: 0.06em; }
html[lang="en"] :is(.xa-lb, .w3-lb) strong { letter-spacing: 0.01em; }
/* 横長の画面の冒頭：見出しは3行（Co-Creating／the Future of／Manufacturing.）、上の一文は2行にして左に寄せる
   （英語は日本語より横に長く、右の輪の名札と重なるため。行の区切りは en/index.html の .nw） */
@media (min-width: 1200px), (min-width: 768px) and (min-aspect-ratio: 901/1000) {
  html[lang="en"] .xa-hero .kv__title { max-width: 8.4em; }
  html[lang="en"] .xa-hero .kv__catch { max-width: 22em; }
}
/* スマホ：模型の名札の長い英語は2行に折り返す（画面の外にはみ出さないように） */
@media (max-width: 767px) {
  html[lang="en"] .w3-lb > span { width: max-content; max-width: 10.5rem; white-space: normal; }
}
