/* 2026-11-28 試作: 3Dの世界を歩くトップページ。
   html.w3d-on は world-20261128.js が3Dの世界を起動できた時だけ付く。
   付かない時(動きを減らす設定・WebGLなし・three.js の読み込み失敗)は、本番どおりの縦に読むページのまま。
   世界はずっと夜。板は、明るい節=白いすりガラス、暗い節=暗いガラス。 */

/* 板の地(2026-11-29)。暗い節の地はこの1つで決まる。全部白の版にする時は --w3d-dark-glass を --w3d-light-glass と同じ値にし、暗い節の文字色の変数も墨色へ替える */
html.w3d-on { --w3d-dark-glass: rgba(10, 10, 13, .66); --w3d-light-glass: rgba(247,246,244,.7); }

html.w3d-on { scroll-behavior: auto; --red-on-dark: #f0555b; }   /* 暗い地の上の赤い字(#b41f24 のままだと 4.5:1 に届かない) */
.w3d-on body { background: #0b0b0e; }

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: pan-y;
  cursor: grab;
}
.w3d-drag #world, .w3d-drag .hero { cursor: grabbing; }
.w3d-drag { -webkit-user-select: none; user-select: none; }

/* 3Dの世界が受け持つ飾りの層は外す(どれも aria-hidden の飾り) */
.w3d-on .secnav,
.w3d-on .band,
.w3d-on .hero-bg,
.w3d-on .hero-grid,
.w3d-on .hero-canvas,
.w3d-on .hero-curtain,
.w3d-on .gallery .marquee { display: none; }
.w3d-on .hero-vignette { opacity: .78; }
.w3d-on .hero-vignette::after { display: none; }
.w3d-on .hero { background: transparent; touch-action: pan-y; }
/* 地図の列(1280px以上)と最初の画面の文字が重ならないよう、文字の左端を地図の右へ寄せる */
@media (min-width: 1280px) {
  .w3d-on .hero-inner { padding-left: max(var(--pad), calc(276px - (100vw - var(--container)) / 2)); }
}

/* 場所ごとの板。位置と大きさは JS が実寸で決める。
   1280px以上は地図の右から画面の右端まで、1279px以下はヘッダーの下から下の帯の上まで(どちらも画面いっぱい) */
.w3d-on main > section {
  position: fixed;
  z-index: 10;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overflow: clip;
  opacity: 0;
  pointer-events: none;
  transform-origin: 50% 60%;
  will-change: opacity, clip-path;
}
.w3d-on main > section.hero { inset: 0; }
.w3d-on main > section:not(.hero) {
  container-type: inline-size;
  --pad: clamp(20px, 5cqw, 64px);
  border: 1px solid rgba(245, 245, 244, .1);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);   /* 1440x900 の rAF 中央値 3.2ms(なし 2.4ms)。17ms を大きく下回るので採用 */
}
.w3d-on main > section.st-on { pointer-events: auto; }
.w3d-on .st-in { position: relative; will-change: transform; }
.w3d-on main > section:not(.hero) > .st-in { box-sizing: border-box; }   /* 最小の高さは JS が板の高さに合わせる(中身が短い節も、写真の地・暗幕が板いっぱいに広がる) */
.w3d-on main > section:not(.hero) > .st-in { padding: clamp(36px, 6.5vh, 72px) 0; }
.w3d-on main > section.gallery > .st-in { padding-bottom: clamp(20px, 3vh, 32px); }
.w3d-on main > section.gallery .sec-head { margin-bottom: 0; }
.w3d-on main > section.cta > .st-in { padding-bottom: 0; }

/* 板の地。明るい節(WHAT WE DO・SERVICE・GALLERY)は本番どおりの墨色の字を白いすりガラスに載せ、暗い節(MISSION・STRENGTH)は暗いガラス。
   白ガラスの上の墨色(#1a1a1c)は、後ろが真っ黒の最悪の場合でも 8:1 以上 */
.w3d-on .mission,
.w3d-on main > .section-dark { background: var(--w3d-dark-glass); border-color: rgba(245, 245, 244, .1); }
.w3d-on .mission-bg { opacity: .22; }
.w3d-on main > section.section-light:not(.gallery) {
  background: var(--w3d-light-glass);
  border-color: rgba(26, 26, 28, .14);
  /* 奥の世界を明るく持ち上げてから白を重ねる。透明度だけで透かすと暗い世界が混ざって灰色になる(2026-11-29 社長「白じゃなくなってるのキモい」) */
  -webkit-backdrop-filter: blur(5px) contrast(.35) brightness(2.1) saturate(.8);
  backdrop-filter: blur(5px) contrast(.35) brightness(2.1) saturate(.8);
}
/* 白ガラスの上の補助色(本番の --light-muted #6b6b70 は、後ろが暗いと 4.5:1 に届かない) */
.w3d-on main > section.section-light { --light-muted: #2a2a2e; }   /* 白の板の上で、後ろが真っ黒でも 4.5:1 以上(2026-11-29 社長「もうちょい透明に」) */
.w3d-on .svc-aud--toc { color: #1a1a1c; }   /* 小さい赤字(本番は --red #b41f24)。後ろが真っ黒の最悪の場合に 4.5:1 へ届かせる */
/* GALLERY は板の中身が見出しだけで、写真は世界の側の額縁。白ガラスは見出しの帯だけにして、下は何も敷かず額縁を見せる */
.w3d-on main > section.gallery {
  background: transparent;
  border-color: rgba(245, 245, 244, .1);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;   /* 板全体のぼかしを外す(額縁の写真がぼやけていた)。見出しの帯のぼかしは ::before が持つ */
}
.w3d-on main > section.gallery::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: clamp(176px, 24vh, 220px);
  background: rgba(247, 246, 244, .88);   /* 板の内側の飾りには、奥を明るくする効果が届かない(板の切り抜きの中で閉じる)。白に見せるため白を濃くする */
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
  pointer-events: none;
}
.w3d-on main > .section-news {
  background:
    radial-gradient(120% 100% at 85% 0%, rgba(217, 49, 58, .22) 0%, rgba(180, 31, 36, 0) 55%),
    linear-gradient(150deg, rgba(78, 10, 14, .66) 0%, rgba(100, 14, 18, .66) 45%, rgba(78, 10, 14, .66) 100%);
  border-color: rgba(255, 255, 255, .14);
}
/* 暗い節の補助色(本番は --muted #9a9a9f。白の上に重ねた最悪の場合の 4.5:1 に届かない) */
.w3d-on main > section:not(.section-light) { --muted: #ececee; }
/* 3Dではヘッダーが暗い地の上に載るので、明るい節でも白い文字のまま */
.w3d-on .site-header.scrolled.on-light { background: rgba(11, 11, 14, .72); border-bottom-color: var(--red); }
.w3d-on .site-header.scrolled.on-light .brand-word,
.w3d-on .site-header.scrolled.on-light .nav-desktop a,
.w3d-on .site-header.scrolled.on-light .nav-desktop .nav-soon { color: var(--text); }
.w3d-on .site-header.scrolled.on-light .nav-toggle[aria-expanded="false"] span { background: var(--text); }
.w3d-on .site-header.scrolled.on-light .brand-mark--white { display: block; }
.w3d-on .site-header.scrolled.on-light .brand-mark--red { display: none; }

/* 板の角の印(差し色は左上の1本だけ) */
.st-frame { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.st-frame::before,
.st-frame::after { content: ""; position: absolute; }
.st-frame::before { top: -1px; left: -1px; width: 40px; height: 1px; background: var(--red); }
.st-frame::after {
  right: 10px; bottom: 10px; width: 10px; height: 10px;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;
  opacity: .2;
}
.section-news .st-frame::before { background: #fff; }

/* 文字の出は板ごとにまとめて出す(本番の .reveal の個別の出は使わない) */
html.w3d-on .reveal { opacity: 1; transform: none; transition: none; }

/* フッターは最後の板(CONTACT)の流れの中に入る */
.w3d-on .site-footer { position: relative; z-index: 1; background: rgba(6, 6, 8, .5); }

/* 1279px以下も板は全面(つまみで広げる動きは使わない) */
@media (max-width: 1279px) {
  .w3d-on main > section:not(.hero) > .st-in { padding-top: clamp(24px, 4vh, 36px); }
}

/* 行き先の札(3Dの目印の上に立つ。遠くから次の行き先が見える) */
.wsigns {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}
.wsign {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 12px 6px;
  white-space: nowrap;
  font-family: var(--ff-en);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .22em;
  color: #f5f5f4;
  background: rgba(11, 11, 14, .78);
  border: 1px solid rgba(245, 245, 244, .3);
  opacity: 0;
  will-change: transform, opacity;
}
.wsign::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 22px;
  background: rgba(245, 245, 244, .5);
}
.wsign-n { color: rgba(245, 245, 244, .72); letter-spacing: .08em; }
.wsign.is-next { border-color: var(--red); }
.wsign.is-next .wsign-n { color: var(--red-on-dark); }
.wsign.is-block { font-family: var(--ff-sans); font-size: 13px; letter-spacing: .06em; }

/* 地図(場所の一覧)。世界はずっと夜なので地の色は1つ */
.wmap, .wbar {
  --w-ink: #f5f5f4;
  --w-sub: rgba(245, 245, 244, .72);
  --w-line: rgba(245, 245, 244, .24);
  --w-bg: rgba(11, 11, 14, .9);
  font-family: var(--ff-en);
  color: var(--w-ink);
}
.wmap {
  position: fixed;
  z-index: 120;
  left: 24px;
  top: calc(var(--header-h) + 20px);
  width: 188px;
  padding: 16px 16px 10px;
  background: var(--w-bg);
  border: 1px solid var(--w-line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.wmap-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .28em;
  color: var(--w-sub);
}
.wmap-head b { font-weight: 600; color: var(--w-ink); letter-spacing: .16em; }
.wmap-svg { display: block; width: 100%; height: auto; overflow: visible; }
.wmap-route { fill: none; stroke: var(--w-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wmap-done { fill: none; stroke: var(--red); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.wmap-dot { fill: #0b0b0e; stroke: var(--w-sub); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.wmap-dot.is-on { fill: var(--red); stroke: var(--red); }
.wmap-hit { fill: transparent; pointer-events: all; cursor: pointer; }
.wmap-hit:hover + .wmap-dot { stroke: var(--w-ink); stroke-width: 2; }
.wmap-me path { fill: var(--w-ink); pointer-events: none; }
.wmap-list { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--w-line); }
.wmap-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .14em;
  color: var(--w-sub);
  transition: color .25s var(--ease);
}
.wmap-list a:hover, .wmap-list a[aria-current] { color: var(--w-ink); }
.wmap-n { width: 20px; flex: none; font-size: 11px; letter-spacing: .06em; }
.wmap-list a[aria-current] .wmap-n { color: var(--red-on-dark); }
.wmap-list a[aria-current]::after { content: ""; flex: 1; height: 1px; background: var(--red); opacity: .8; }

/* 1279px以下: 下の帯に今の場所と[MAP]。押すと地図が開く(線の図を全幅、下に一覧を2列4行) */
.wbar { display: none; }
@media (max-width: 1279px) {
  .wbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    z-index: 121;
    left: 0;
    right: 0;
    bottom: 0;
    height: 52px;
    padding: 0 8px 0 16px;
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: content-box;
    background: var(--w-bg);
    border-top: 1px solid var(--w-line);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  .wbar-mini { width: 54px; height: 36px; flex: none; }
  .wbar-now { flex: 1; min-width: 0; font-size: 12px; font-weight: 500; letter-spacing: .16em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wbar-n { color: var(--red-on-dark); margin-right: 4px; }
  .wbar-of { color: var(--w-sub); margin-right: 10px; }
  .wbar-btn {
    flex: none;
    min-width: 72px;
    height: 44px;
    border: 1px solid var(--w-line);
    background: transparent;
    color: var(--w-ink);
    font: 600 12px/1 var(--ff-en);
    letter-spacing: .24em;
    padding: 0 0 0 .24em;
    cursor: pointer;
  }
  .wmap {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: calc(52px + env(safe-area-inset-bottom) + 8px);
    width: auto;
    max-width: 480px;
    padding: 14px 16px 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s;
  }
  .wmap.open { opacity: 1; visibility: visible; transform: none; }
  /* 地図を開いている間は板を見せない(地図と帯の間の隙間から本文の切れ端が見えないように) */
  .w3d-mapopen main > section:not(.hero) { visibility: hidden; }
  .wmap-svg { max-height: 30vh; }
  .wmap-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(4, auto);
    grid-auto-flow: column;
    column-gap: 16px;
  }
  .wmap-list a { min-height: 44px; }
}

/* CONTACT の写真の暗幕: 節の子を .st-in へ移したので、写真(z-index:-2)と同じ層の中に暗幕を置き直す。
   本番の .cta::before は写真の下に回って効かなくなるため外す */
.w3d-on .cta > .st-in { isolation: isolate; }
.w3d-on .cta > .st-in::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(10, 10, 10, .72);
  pointer-events: none;
}
.w3d-on .cta::before { display: none; }

/* CONTACT の写真は板の向こうの世界を隠さないよう薄くする(暗幕と合わせて文字の地は暗いまま) */
.w3d-on .cta-photo { opacity: .45; }

/* 縦長(スマホ)の最初の画面(2026-11-29): 字のまとまりを画面の下寄りへ。画面の上半分は世界(赤い光の柱・地平・街の影)を見せる。
   本番の暗幕(下へ行くほど濃い)は、字の地になる下の4割だけに絞る */
@media (orientation: portrait) {
  .w3d-on .hero-stage { align-items: flex-end; }
  .w3d-on .hero-vignette {
    opacity: 1;
    background: linear-gradient(to bottom, rgba(11,11,14,.5) 0%, rgba(11,11,14,0) 16%, rgba(11,11,14,0) 44%, rgba(11,11,14,.6) 58%, rgba(11,11,14,.78) 100%);
  }
  /* 字の下の空き: 下の帯にくっつけず、画面の高さに合わせて取る(2026-11-29 社長「文字が下に寄りすぎ」) */
  .w3d-on .hero-inner { padding-bottom: calc(52px + env(safe-area-inset-bottom) + clamp(40px, 10vh, 110px)); }
  .w3d-on .hero-sub { margin-top: 16px; }
}

/* 試作(2026-11-29 社長「白背景のところを全部、newsセクションと同じブランドカラー背景に変えてみて」)。
   白い節(WHAT WE DO・SERVICE・GALLERY の見出しの帯)の地を NEWS と同じ赤にし、節の中の色の変数を NEWS と同じ白の字・白の差し色へ置き換える    SERVICE だけは白に戻す(2026-11-29 社長「やっぱserviseの背景だけ白に戻して」) */
.w3d-on main > section.section-light:not(.service) {
  --light: #6e0d12;
  --light-2: rgba(255, 255, 255, .12);
  --light-text: #fff;
  --light-muted: rgba(255, 255, 255, .86);
  --light-line: rgba(255, 255, 255, .22);
  --red: #fff;
  --red-bright: #fff;
  color: #fff;
}
.w3d-on main > section.section-light:not(.service):not(.gallery),
.w3d-on main > section.gallery::before {
  background:
    radial-gradient(120% 100% at 85% 0%, rgba(217, 49, 58, .1) 0%, rgba(180, 31, 36, 0) 55%),
    linear-gradient(150deg, rgba(78, 10, 14, .42) 0%, rgba(100, 14, 18, .42) 45%, rgba(78, 10, 14, .42) 100%);   /* 社長「赤がうるさく見えるから、透明度上げてみて」(.66→.42・光だまり .22→.1) */
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.w3d-on main > section.section-light:not(.service):not(.gallery) { border-color: rgba(255, 255, 255, .14); }
.w3d-on main > section.section-light:not(.service) .sec-ghost { -webkit-text-stroke: 1px rgba(255, 255, 255, .16); text-stroke: 1px rgba(255, 255, 255, .16); }
.w3d-on main > section.section-light:not(.service) .st-frame::before { background: #fff; }
/* 赤い板で墨の直書きが残っていた2か所を白へ(2026-11-29 社長「whatwedoのところ、黒文字の要素が残っててめっちゃ見にくいよ」) */
.w3d-on main > section.section-light:not(.service) .calc-text { color: rgba(255, 255, 255, .9); }
.w3d-on main > section.section-light:not(.service) .pillar-num { -webkit-text-stroke-color: rgba(255, 255, 255, .55); }
/* スマホのメニュー: ヘッダーのぼかし(backdrop-filter)が付くと、中の固定配置のメニューが画面でなくヘッダーの箱を基準にしてしまう。開いている間だけぼかしを外す(2026-11-29 社長「スマホ版のハンバーガーメニューがバグってる。ページの途中で押してみ」) */
.site-header:has(.mobile-nav.open) { -webkit-backdrop-filter: none; backdrop-filter: none; transition: none; }
