/* 2026-08-21 CEO指示: ヘッダー右上CTA・右サイドCTA・下部固定バーをトップページ以外でも常時表示。
   トップページは front-page.php 既存実装(FV通過でフェードアウト)を維持・本ファイルは非対象。
   ヘッダーCSSはグローバルnav共通のため全ページ適用(トップページと重複しても副作用なし)。 */

/* 1) ヘッダー右上ボタン化（全ページ共通） */
#header .c-gnav, #fix_header .c-gnav{gap:14px}
#header .c-gnav>li>a, #fix_header .c-gnav>li>a{padding:0 2px;letter-spacing:.02em}
#header .menu-item-652 a, #fix_header .menu-item-652 a{background:var(--accent,#a9540c);color:#fff!important;padding:8px 14px!important;border-radius:6px;font-weight:700;font-size:12.5px}
#header .menu-item-229 a, #fix_header .menu-item-229 a{background:#1a2b3c;color:#fff!important;padding:8px 14px!important;border-radius:6px;font-weight:700;font-size:12.5px}
#header .menu-item-652 a:hover, #fix_header .menu-item-652 a:hover,
#header .menu-item-229 a:hover, #fix_header .menu-item-229 a:hover{opacity:.88}

/* 2) 右サイドCTA（非トップページ・常時表示） */
.mm-side-cta-g{position:fixed;right:0;top:38%;z-index:9998;display:flex;flex-direction:column;box-shadow:-3px 0 10px rgba(0,0,0,.12)}
.mm-side-cta-g a{display:flex;flex-direction:column;align-items:center;justify-content:center;width:56px;padding:14px 4px;color:#fff;font-size:11px;font-weight:700;letter-spacing:.08em;text-decoration:none;border-bottom:1px solid rgba(255,255,255,.25);writing-mode:vertical-rl}
.mm-side-cta-g a.tel{background:var(--accent,#a9540c)}
.mm-side-cta-g a.works{background:var(--navy,#1a2b3c)}
.mm-side-cta-g a:hover{opacity:.9}
@media (max-width:900px){ .mm-side-cta-g{display:none} }

/* 3) 下部固定バー（非トップページ・常時表示） */
.mm-bottombar-g{position:fixed;left:0;right:0;bottom:0;z-index:9997;display:grid;grid-template-columns:1fr 1fr}
.mm-bottombar-g a{display:flex;align-items:center;justify-content:center;gap:6px;color:#fff;font-size:13px;font-weight:700;text-decoration:none;padding:14px 8px;letter-spacing:.03em}
.mm-bottombar-g a.f1{background:var(--gold,#c8a96e);color:#3a2f10}
.mm-bottombar-g a.f2{background:var(--accent,#a9540c)}
@media (max-width:900px){
  .mm-bottombar-g a{font-size:12px;padding:12px 6px}
}

/* ============================================================
   検収差し戻し #1 — A#8(浮遊固定UIの重なり)がトップページにしか効いていなかった件
   2026-08-21-19-45（対話セッション・追記のみ）

   実測（node scripts/verify-mamori-a8-floating-ui.mjs https://.../contact/ ・是正前）:
     1280 @scrollY=200〜1400（5点）
       .p-fixBtnWrap  [1188,808]-[1240,860]
       .mm-bottombar-g[   0,851]-[1280,900]
       → OVERLAP 52x9px（ページトップボタンの下端がバーに埋まる）＋ PC同時可視 3 > 2
      375 @scrollY=200〜1400（5点）
       .p-fixBtnWrap  [ 310,731]-[ 362,783]
       .mm-bottombar-g[   0,757]-[ 375,800]
       → OVERLAP 52x26px（ボタン高さの半分が水没）
     ＝ RESULT: MAMORI-A8-FLOATING-VIOLATION（/contact/・/checkup/・/works/ で同一に再現）

   15:30サイクルの是正は front-page.php 側の `.mm-fv-bottombar`（トップ専用）だけを対象にしており、
   全ページ共通の `.mm-bottombar-g` は同じ欠陥を持ったまま残っていた。
   トップと同じ判断（PCはバーを消す／SPはバーを残しページトップボタンを退避）をここでも適用する。

   (1) PC(min-width:901px)＝バーを消す。宛先の純減はない
       （ヘッダー右上の「無料診断」「お問い合わせ」＋右サイドCTAが常時ある）。
   (2) SP(max-width:900px)＝バーは唯一の親指到達CTAなので残し、ページトップボタンを
       バーの上へ退避する。SWELL既定の bottom:16.875px は上書きせず margin-bottom で相対的に持ち上げる。
       バー実測高 43px + 余白19px = 62px（トップページの実装値と揃える）。
       :has() 非対応環境では何も起きず現状維持＝退行しない。
   ============================================================ */
@media (min-width:901px){
  .mm-bottombar-g.mm-bottombar-g{display:none}
}
@media (max-width:900px){
  body:has(.mm-bottombar-g) .p-fixBtnWrap{
    margin-bottom:62px;
    transition:margin-bottom .3s ease;
  }
}

/* ============================================================
   サイクル2で複製した「/checkup/(page-id-651) 用フォーム書式19ルール」は
   2026-08-22 のサイクル4でここから削除した。

   理由: 同じ宣言が style.css(.page-id-223) と本ファイル(.page-id-651) に二重に存在し、
     片方だけ直すと乖離する負債だったため（複製した時点でその旨をここに明記していた）。
   移設先: style.css の `:is(.mm-form,.page-id-223,.page-id-651) .wpcf7-form ...` ブロック1箇所。
     宣言の中身は変えていないので見た目は変わらない（前後のレイアウト・スナップショット比較で確認済み）。
   今後フォームを足すページは、囲みに class="mm-form" を付ければ同じ書式が効く。
   ============================================================ */

/* ============================================================
   2026-08-23-17-1x A案 — SPでページトップFABが本文の「文字」を覆っていた件
   （measure-fleet-fixed-overlay-glyph.mjs 実測 = 10ページ42箇所・SP375のみ / PC1280は0件）

   経緯: 上の 2026-08-21 の是正は「ボタンとバーの重なり」を margin-bottom:62px で解いたが、
     その結果ボタンは本文の真上へ持ち上がり、今度は**本文の描画済みグリフ**を覆うようになった。
     既存ゲート11本のどれもこの次元を見ていない（memory feedback_fixed_overlay_covers_body_glyphs_no_gate）。

   方針: kinorinobe(同日)の「右レール合流方式」の mamori 版。
     浮かせて避けるのをやめ、**既に全幅で固定されているバーの右端へ合流**させる。
     全幅の帯の上を本文が流れるのはWebの通常挙動なので、合流させた時点で
     本文グリフとの重なりは構造的にゼロになる（座標調整で「今は当たらない」を作るのではない）。

   対象バーは2つある（実測で確認）:
     - 下層10ページ = .mm-bottombar-g   高さ43px
     - トップページ = .mm-fv-bottombar  高さ48px（#mmFvBottombar・scrollY=0から常時 is-visible）
     FABは scrollY>=200 で現れるので、FABが見える時はバーも必ず出ている＝常時ドックできる。

   実測の根拠:
     - 3列目を clamp(36px,12vw,44px) にすると、最狭の320pxでも
       f2「無料外壁診断を申し込む」の実テキスト幅136px < 箱141px で1行を維持する
     - :has() 非対応環境では何も起きず現状維持＝退行しない（上の2026-08-21実装と同じ方針）
   ============================================================ */
@media (max-width:900px){
  @supports selector(:has(*)){
    :root{--mm-pagetop-w:clamp(36px,12vw,44px)}
    body:has(.mm-bottombar-g){--mm-bar-h:43px}
    body:has(.mm-fv-bottombar){--mm-bar-h:48px}

    /* バーに3列目を作り、そこがページトップボタンの居場所になる */
    body:has(.p-fixBtnWrap) :is(.mm-bottombar-g,.mm-fv-bottombar):not(#_){
      grid-template-columns:1fr 1fr var(--mm-pagetop-w)
    }
    body:has(.p-fixBtnWrap) :is(.mm-bottombar-g,.mm-fv-bottombar):not(#_)::after{content:"";display:block}
    body:has(.p-fixBtnWrap) :is(.mm-bottombar-g,.mm-fv-bottombar):not(#_) a{min-width:0;white-space:nowrap}

    /* 2026-08-21 の退避(margin-bottom:62px)は解除する＝浮かせるのをやめたので不要 */
    body:has(.mm-bottombar-g,.mm-fv-bottombar) .p-fixBtnWrap:not(#_){
      margin-bottom:0;bottom:0;right:0;
      width:var(--mm-pagetop-w);height:var(--mm-bar-h);z-index:9998;
      transition:none;
    }
    body:has(.mm-bottombar-g,.mm-fv-bottombar) .p-fixBtnWrap:not(#_)>#pagetop{
      width:100%;height:100%;
      border:0;border-radius:0;box-shadow:none;opacity:1;
      background:#1a1a1a;color:#fff;
    }
  }
}

/* --- トップページのバーを他10ページと同じ「常時表示」に揃える ------------
   実測: .mm-fv-bottombar は FV帯(scrollY 0〜約900)でしか is-visible にならず、
     1500以降ページ末尾(17,455px)までずっと opacity:0 / translateY(100%) だった。
     一方 .mm-bottombar-g を持つ下層10ページは同じ2つのCTA
     (「色で施工事例を見る」「無料外壁診断を申し込む」)を常時表示している。
     ＝同じCTAなのにトップだけ型から外れている。

   これを揃えると2つ同時に解ける:
     (1) 親指到達CTAの有無がサイト全体で一致する（トップだけ16,500px分CTAが消えない）
     (2) ページトップFABに合流先ができ、トップページでも本文グリフとの重なりが構造的にゼロになる
         （揃える前は、置き場所を1pxずつ動かしても実測3件が残った＝浮遊させる限り避けられない）

   JS(front-page.php)が付け外しする .is-visible はそのまま残す。ここではCSSの見え方だけを
   常時ONにしている（:not(#_) で特異度を1つ上げるだけ・!important は使わない）。 */
@media (max-width:900px){
  @supports selector(:has(*)){
    .mamori .mm-fv-bottombar:not(#_){transform:none;opacity:1;pointer-events:auto}
  }
}

/* --- 合流させたボタンがバーに「クリックを奪われる」件の是正 ------------------
   実測（elementsFromPoint）: 下層ページの .p-fixBtnWrap は
     DIV.wp-singular…(position:relative; z-index:1) の**内側**にあるため、
     z-index:9998 を指定してもそれは「z=1のスタック文脈の中での9998」でしかなく、
     body直下の .mm-bottombar-g(z-index:9997) に**painted above**されてしまう。
     その結果 elementFromPoint が常にバーを返し、ページトップボタンが押せなくなっていた
     （Playwrightの実クリックも "mm-bottombar-g intercepts pointer events" で失敗）。

   バー自身の箱は背景を持たない（背景色を持つのは a.f1 / a.f2 だけ）ので、
   バーの箱と3列目のスペーサだけをポインタ透過にすれば、
   見た目は一切変えずにクリックだけがボタンへ通る。CTAリンクは明示的に auto へ戻す。
   ＝z-index を上げ合う消耗戦にしない（祖先の z:1 は他所に影響するので触らない）。 */
@media (max-width:900px){
  @supports selector(:has(*)){
    body:has(.p-fixBtnWrap) :is(.mm-bottombar-g,.mm-fv-bottombar):not(#_){pointer-events:none}
    body:has(.p-fixBtnWrap) :is(.mm-bottombar-g,.mm-fv-bottombar):not(#_)::after{pointer-events:none}
    body:has(.p-fixBtnWrap) :is(.mm-bottombar-g,.mm-fv-bottombar):not(#_)>a{pointer-events:auto}
  }
}

/* ── 1ページしか無いときのページネーションを隠す（2026-08-23 B案実採点で発見）──────────
   SWELL親テーマ swell/parts/post_list/item/pagination.php は、総ページ数が1でも
   .c-pagination を出力するため、リンクを1つも持たない「1」だけの箱が残る。
   /report/（点検だより・記事3件）で「続きがある」ように見える残骸になっていた。
   親テーマは触らず、「リンクが1つも無い＝ページが1つしかない」をCSSで判定して隠す。 */
.c-pagination:not(:has(a)) { display: none; }
