/* ================================================================
   A. Services Card 4枚 : 元デザイン完全復元  [Scoped: #page-5951]
   ================================================================ */
#page-5951 #services-app {font-family:"Montserrat",sans-serif;}
#page-5951 #services-app h2 {font-weight:400;font-family:"Montserrat",sans-serif;}

#page-5951 #services-app .unique-card{
  position:relative;overflow:hidden;cursor:pointer;
  transition:box-shadow .35s ease;
}
#page-5951 #services-app .unique-card::before{
  content:"";position:absolute;inset:0;z-index:0;
  background:#4f46e5;transition:.6s ease;
}
/* clip-path 円配置 (4方向) */
#page-5951 #services-app .unique-card:nth-child(1)::before{
  bottom:0;right:0;clip-path:circle(calc(6.25rem + 7.5vw) at 100% 100%);
}
#page-5951 #services-app .unique-card:nth-child(2)::before{
  bottom:0;left:0; clip-path:circle(calc(6.25rem + 7.5vw) at   0% 100%);
}
#page-5951 #services-app .unique-card:nth-child(3)::before{
  top:0;   right:0;clip-path:circle(calc(6.25rem + 7.5vw) at 100%   0%);
}
#page-5951 #services-app .unique-card:nth-child(4)::before{
  top:0;   left:0; clip-path:circle(calc(6.25rem + 7.5vw) at   0%   0%);
}
/* ホバー拡大・影 */
#page-5951 #services-app .unique-card:hover{
  box-shadow:.063rem .063rem 1.25rem .375rem rgba(0,0,0,.53);
}
#page-5951 #services-app .unique-card:hover::before{
  clip-path:circle(110vw at 100% 100%);
}
#page-5951 #services-app .unique-card p{transition:.8s;}
#page-5951 #services-app .unique-card:hover p{color:#fff;}

/* サークル画像 (>992px) */
#page-5951 #services-app .unique-circle{display:none;}
@media (min-width:62.5rem){
  #page-5951 #services-app .unique-circle{
    display:block;position:absolute;width:100%;height:100%;
    object-fit:cover;z-index:0;
  }
}
#page-5951 #services-app .unique-card:nth-child(1) .unique-circle{
  bottom:0;right:0;clip-path:circle(calc(6.25rem + 7.5vw) at 100% 100%);
}
#page-5951 #services-app .unique-card:nth-child(2) .unique-circle{
  bottom:0;left:0; clip-path:circle(calc(6.25rem + 7.5vw) at   0% 100%);
}
#page-5951 #services-app .unique-card:nth-child(3) .unique-circle{
  top:0;   right:0;clip-path:circle(calc(6.25rem + 7.5vw) at 100%   0%);
}
#page-5951 #services-app .unique-card:nth-child(4) .unique-circle{
  top:0;   left:0; clip-path:circle(calc(6.25rem + 7.5vw) at   0%   0%);
}

/* 初期フェードイン */
#page-5951 #services-app .fade-in{opacity:0;animation:svcFadeIn 1s ease forwards;}
@keyframes svcFadeIn{
  from{opacity:0;transform:translateY(20px);}
  to  {opacity:1;transform:translateY(0);}
}
#page-5951 #services-app .unique-card.fade-in:nth-child(1){animation-delay:.2s;}
#page-5951 #services-app .unique-card.fade-in:nth-child(2){animation-delay:.4s;}
#page-5951 #services-app .unique-card.fade-in:nth-child(3){animation-delay:.6s;}
#page-5951 #services-app .unique-card.fade-in:nth-child(4){animation-delay:.8s;}

/* ================================================================
   B. 共通カラー変数・ベース  [Scoped variables on #page-5951]
   ================================================================ */
#page-5951{
  --c-bg:#fff;
  --c-card-bg:rgba(255,255,255,.9);
  --c-card-blur:14px;
  --c-border:#00a3ff;
  --c-accent:#0091ff;
  --c-text:#000;
  --c-muted:#444;
  --c-tech-bg:rgba(0,161,255,.08);
  --c-tech-border:rgba(0,161,255,.15);
  --c-label-bg:rgba(2,215,180,.35);
}

/* ================================================================
   C. モーダル共通装飾（3 モーダル）
   ================================================================ */
#page-5951 .bd-modal{
  display:none;position:fixed;inset:0;background:rgba(0,0,0,.85);
  align-items:center;justify-content:center;z-index:999;overflow:hidden;
}
#page-5951 .bd-modal.open{display:flex;}
#page-5951 .bd-modal-overlay{position:absolute;inset:0;cursor:pointer;}

#page-5951 .bd-modal-container{
  position:relative;width:100vw;height:100vh;max-width:100vw;max-height:100vh;
  background:#fff;color:var(--c-text);overflow-y:auto;
  transform:translateY(80px) scale(.92);opacity:0;
  transition:opacity .55s ease,transform .55s ease;
}
#page-5951 .bd-modal.open .bd-modal-container,
#page-5951 .bd-modal.is-open .bd-modal-container{
  transform:translateY(0) scale(1);opacity:1;
}

/* クローズボタン : ───────── よりお洒落にアップグレード ───────── */
#page-5951 .bd-modal-close{
  position:fixed;top:48px;left:24px;width:46px;height:46px;border:none;
  border-radius:50%;font-size:1.7rem;line-height:46px;text-align:center;
  color:#fff;
  background:linear-gradient(145deg,#4fa8ff 0%,#0072ff 35%,#0054ff 100%);
  cursor:pointer;z-index:1003;
  box-shadow:
    0 4px 14px rgba(0,0,0,.35),
    0 0 0 4px rgba(255,255,255,.18) inset;
  display:flex;align-items:center;justify-content:center;overflow:hidden;
  transition:transform .4s ease,box-shadow .4s ease,background .6s ease;
}
#page-5951 .bd-modal-close::after{
  content:"";position:absolute;inset:-8px;border-radius:50%;
  background:conic-gradient(from 180deg at 50% 50%,
    transparent 0deg,
    rgba(255,255,255,.45) 90deg,
    transparent 180deg,
    transparent 360deg);
  animation:bdSpin 2.8s linear infinite;
  z-index:-1;
}
@keyframes bdSpin{to{transform:rotate(360deg);}}
#page-5951 .bd-modal-close:hover{
  transform:rotate(180deg) scale(1.12);
  box-shadow:
    0 8px 26px rgba(0,0,0,.45),
    0 0 0 4px rgba(255,255,255,.28) inset;
}
@media (max-width:768px){
  #page-5951 .bd-modal-close{
    width:42px;height:42px;font-size:1.4rem;line-height:42px;
    top:56px;left:16px;
  }
}

/* 右サイド固定ナビ */
#page-5951 .bd-nav{
  position:fixed;top:50%;right:32px;transform:translateY(-50%);
  display:flex;flex-direction:column;gap:16px;z-index:1002;
}
#page-5951 .bd-nav button{
  width:52px;height:52px;border:none;border-radius:50%;cursor:pointer;
  background:rgba(255,255,255,.85);border:2px solid var(--c-border);
  backdrop-filter:blur(6px);display:flex;align-items:center;justify-content:center;
  transition:.35s ease;box-shadow:0 6px 18px rgba(0,0,0,.12);
}
#page-5951 .bd-nav button i{font-size:1.2rem;color:var(--c-text);}
#page-5951 .bd-nav button:hover{
  transform:scale(1.2) rotate(12deg);background:var(--c-accent);
  box-shadow:0 8px 26px rgba(0,0,0,.18);
}
#page-5951 .bd-nav button:hover i{color:#fff;}
@media (max-width:768px){
  #page-5951 .bd-nav{right:16px;}
}

/* ================================================================
   D. Stellar-Scroll セクション & カード（モーダル内）
   ================================================================ */
#page-5951 .bd-modal section{
  position:relative;display:flex;align-items:center;justify-content:center;
  width:100vw;height:100vh;overflow:hidden;z-index:0;
}
#page-5951 .bd-modal section::before{
  content:"";position:absolute;inset:0;z-index:-2;
  background-size:cover;background-position:center;
  transform:scale(1.15);filter:brightness(.9) saturate(1.05);
  opacity:0;transition:opacity .8s;
}
#page-5951 .bd-modal section.bd-active::before{opacity:1;}
#page-5951 .bd-modal section::after{
  content:"";position:absolute;inset:0;z-index:-1;
  background:radial-gradient(ellipse at center,transparent 40%,rgba(255,255,255,.85) 100%);
}

/* コンテンツカード */
#page-5951 .bd-card{
  width:min(92vw,1100px);max-height:calc(100vh - 4rem);
  padding:3.6rem 4rem;border-radius:28px;
  background:var(--c-card-bg);backdrop-filter:blur(var(--c-card-blur));
  border:2px solid var(--c-border);box-shadow:0 18px 44px rgba(0,0,0,.16);
  transform:translateY(60px) scale(.92);opacity:0;overflow-y:auto;
  scrollbar-width:thin;scrollbar-color:rgba(0,161,255,.35) transparent;
  font-size:1.1rem;
}
#page-5951 .bd-card::-webkit-scrollbar{width:10px;}
#page-5951 .bd-card::-webkit-scrollbar-track{background:rgba(0,0,0,.05);border-radius:10px;}
#page-5951 .bd-card::-webkit-scrollbar-thumb{
  background:rgba(0,161,255,.35);border-radius:10px;
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.6);
}
#page-5951 .bd-card::-webkit-scrollbar-thumb:hover{background:rgba(0,161,255,.5);}

/* ★ カード見出しテキストを常に一行で自動縮小（Services のカード） */
#page-5951 #services-app .unique-card h2{
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  font-size:clamp(1rem, 2vw, 1.6rem);
}

#page-5951 .bd-card-header{display:flex;align-items:center;gap:1.4rem;margin-bottom:2rem;}
#page-5951 .bd-icon{
  width:64px;height:64px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  background:rgba(255,255,255,.8);border:2px solid var(--c-border);
  box-shadow:inset 0 0 0 4px rgba(0,0,0,.06);
}
#page-5951 .bd-icon i{font-size:1.6rem;color:var(--c-accent);}
#page-5951 .bd-card-header h2{margin:0;font-size:2.8rem;font-weight:800;line-height:1;}
#page-5951 .bd-tagline{margin:4px 0 0;font-size:1.15rem;font-weight:600;color:var(--c-accent);}
#page-5951 .bd-summary{margin-bottom:2.2rem;font-size:1.05rem;line-height:1.8;color:var(--c-text);}

#page-5951 .bd-feature{
  background:rgba(255,255,255,.7);border:1px solid rgba(0,161,255,.3);
  border-radius:18px;margin-bottom:1.4rem;padding:1.4rem 1.6rem;
  box-shadow:0 10px 26px rgba(0,0,0,.1);
  transition:transform .4s,box-shadow .4s;
}
#page-5951 .bd-feature:last-of-type{margin-bottom:0;}
#page-5951 .bd-feature:hover{
  transform:translateY(-6px) scale(1.03);box-shadow:0 16px 40px rgba(0,0,0,.16);
}
#page-5951 .bd-feature h3{
  margin:0 0 .8rem;display:flex;align-items:center;gap:.6rem;
  font-size:1.35rem;font-weight:700;color:var(--c-text);
}
#page-5951 .bd-feature h3 i{font-size:1.2rem;color:var(--c-accent);}
#page-5951 .bd-feature p.bd-desc{margin:0 0 .8rem;font-size:.95rem;line-height:1.6;color:var(--c-text);}
#page-5951 .bd-feature ul{margin:0 0 .6rem;padding-left:1.2rem;list-style:none;font-size:.95rem;color:var(--c-text);}
#page-5951 .bd-feature ul li{margin:.4rem 0;position:relative;padding-left:1.4rem;}
#page-5951 .bd-feature ul li i{position:absolute;left:0;top:.15rem;color:var(--c-accent);}

#page-5951 .bd-tools{margin-top:2.2rem;border-top:1px solid rgba(0,161,255,.3);padding-top:1.4rem;font-size:0;}
#page-5951 .bd-tool-label{
  display:inline-block;margin-bottom:.6rem;padding:.3rem .9rem;background:var(--c-label-bg);
  border-radius:14px;font-size:.95rem;font-weight:700;color:var(--c-text);
}
#page-5951 .bd-tools .bd-tech{
  display:inline-block;margin:0 .3rem .3rem 0;padding:.3rem .7rem;
  background:var(--c-tech-bg);border-radius:14px;
  box-shadow:inset 0 0 0 1px var(--c-tech-border);
  font-size:.9rem;font-weight:600;color:var(--c-text);
}

/* 背景画像（モーダル各セクション） */
#page-5951 #bd-mech::before{background-image:url("https://nng2692600.xsrv.jp/wp-content/uploads/2025/06/ppp.jpg");}
#page-5951 #bd-soft::before{background-image:url("https://nng2692600.xsrv.jp/wp-content/uploads/2025/06/mmm.jpg");}
#page-5951 #bd-elec::before{background-image:url("https://nng2692600.xsrv.jp/wp-content/uploads/2025/06/ccc.jpg");}

/* ------------------------------------------------
   既存レスポンシブ調整
   ------------------------------------------------ */
@media (max-width:768px){
  #page-5951 .bd-card{padding:2.4rem 2.2rem;}
  #page-5951 .bd-card-header h2{font-size:2.2rem;}
}

/* ================================================================
   E. 追加レスポンシブ強化
   ================================================================ */

/* -------- 992px 以下：カード 2 列・フォント縮小 -------- */
@media (max-width:992px){
  /* Services カードを 2 列に */
  #page-5951 #services-app .unique-grid-offer{
    display:grid;grid-template-columns:repeat(2,1fr);gap:1.5rem;
    padding-bottom:3rem;
  }
  /* テキストサイズ微調整 */
  #page-5951 #services-app .unique-card p{font-size:.95rem;}
  #page-5951 .bd-card-header h2{font-size:2.4rem;}
  #page-5951 .bd-icon{width:58px;height:58px;}
  #page-5951 .bd-nav{right:24px;}
  #page-5951 .bd-nav button{width:48px;height:48px;}
}

/* -------- 768px 以下：カード 1 列・ナビ非表示 -------- */
@media (max-width:768px){
  /* Services カードを 1 列に */
  #page-5951 #services-app .unique-grid-offer{
    display:grid;grid-template-columns:1fr;gap:1.25rem;
    padding-bottom:5rem;
  }
  #page-5951 #services-app .unique-card{padding:1.4rem 1.4rem;}
  #page-5951 #services-app .unique-card p{font-size:.9rem;}

  /* モーダル・カード調整 */
  #page-5951 .bd-card{padding:2.2rem 1.8rem;}
  #page-5951 .bd-card-header{flex-direction:column;align-items:flex-start;}
  #page-5951 .bd-card-header h2{font-size:2rem;}
  #page-5951 .bd-feature{padding:1.2rem 1.2rem;}
  #page-5951 .bd-feature h3{font-size:1.2rem;}

  /* サイドナビは狭い画面では隠す */
  #page-5951 .bd-nav{display:none;}

  /* クローズボタン（左配置・やや下） */
  #page-5951 .bd-modal-close{
    width:42px;height:42px;font-size:1.4rem;line-height:42px;
    top:56px;left:16px;
  }

  /* 最下段カードの底マージンを増やす */
  #page-5951 #services-app .unique-card:last-child{margin-bottom:3.5rem;}
}

/* -------- 480px 以下：最小サイズ対応 -------- */
@media (max-width:480px){
  #page-5951 #services-app .unique-card{padding:1.2rem;}
  #page-5951 #services-app .unique-card p{font-size:.85rem;}

  #page-5951 .bd-card{padding:1.8rem 1.2rem;}
  #page-5951 .bd-card-header h2{font-size:1.8rem;}
  #page-5951 .bd-feature h3{font-size:1.1rem;}
  #page-5951 .bd-feature ul{font-size:.88rem;padding-left:1rem;}

  /* クローズボタンさらに縮小＋さらに下へ */
  #page-5951 .bd-modal-close{
    width:38px;height:38px;font-size:1.3rem;line-height:38px;
    top:64px;left:16px;
  }

  /* モバイル最小幅ではさらに余白を確保 */
  #page-5951 #services-app .unique-card:last-child{margin-bottom:4.5rem;}
}

/* ================================================================
   F. フッター干渉防止（共通・安全マージン）
   ================================================================ */
#page-5951 #services-app section{padding-bottom:clamp(3rem,6vw,6rem);}
@media (max-width:992px){
  #page-5951 #services-app section{min-height:auto;}
}

/* ================================================================
   G. ★ iPhone 等での上下カード見切れ防止（レスポンシブ追加）
   ================================================================ */

/* 992px 以下：ブラウザUIを考慮した安全な高さと余白（見切れ防止） */
@media (max-width:992px){
  /* セクションは高さ固定を解除（モーダル外の Services セクションのみ対象） */
  #page-5951 #services-app section{
    height:auto !important;
    min-height:100svh;
    padding-top:max(12px, env(safe-area-inset-top));
    padding-bottom:max(16px, env(safe-area-inset-bottom));
    overflow:visible;
  }

  /* Services のカードグリッド上下にわずかな余白を付与 */
  #page-5951 #services-app .unique-grid-offer{
    padding-top:clamp(10px,2vh,16px);
    padding-bottom:clamp(16px,3vh,24px);
  }

  /* フッターとの距離を“少しだけ”に（既存の F を上書き） */
  #page-5951 #services-app section{
    padding-bottom:clamp(1rem,2.5vw,2rem) !important;
  }
}

/* 480px 以下：iPhone SE 等の超小画面でさらに安全側に調整 */
@media (max-width:480px){
  #page-5951 #services-app section{
    height:auto !important;
    min-height:100svh;
    padding-top:max(14px, env(safe-area-inset-top));
    padding-bottom:max(18px, env(safe-area-inset-bottom));
  }

  /* グリッド内の上下余白をもう少しだけ確保 */
  #page-5951 #services-app .unique-grid-offer{
    padding-top:clamp(12px,2.5vh,18px);
    padding-bottom:clamp(18px,3.5vh,26px);
  }

  /* 最下段カードとフッターの距離は最小限に */
  #page-5951 #services-app section{
    padding-bottom:clamp(.8rem,2.2vw,1.6rem) !important;
  }
}

/* 追加の保険：アンカーリンクでセクション先頭が隠れないように（5951限定） */
#page-5951{
  scroll-padding-top:max(12px, env(safe-area-inset-top));
  scroll-padding-bottom:max(16px, env(safe-area-inset-bottom));
}
