/* =========================================================
 * v1.6.4 Mobile Responsive Redesign
 * スマホ/小型タブレットでは、セクション見出し・本文・CTA・カードを
 * すべて通常フローの縦積みに戻し、重なり・文字切れ・固定CTA干渉を防ぐ。
 * このファイルは全CSSの最後に読み込む前提。
 * ======================================================= */

@media (max-width: 980px){
  :root{
    --nk-con-mobile-header-height:64px;
    --nk-con-mobile-cta-height:78px;
    --nk-con-mobile-gutter:clamp(18px,4.6vw,28px);
    --nk-con-mobile-section-y:clamp(64px,10vw,92px);
    --nk-con-mobile-gap:clamp(22px,5.8vw,36px);
    --nk-con-mobile-bottom-space:calc(var(--nk-con-mobile-cta-height) + env(safe-area-inset-bottom,0px) + 34px);
  }

  html{
    width:100% !important;
    max-width:100% !important;
    overflow-x:hidden !important;
    scroll-padding-top:calc(var(--nk-con-mobile-header-height) + 16px) !important;
    scroll-padding-bottom:var(--nk-con-mobile-bottom-space) !important;
    -webkit-text-size-adjust:100% !important;
    text-size-adjust:100% !important;
  }

  body.nk-construction-theme{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
    padding-top:var(--nk-con-mobile-header-height) !important;
    padding-bottom:var(--nk-con-mobile-bottom-space) !important;
  }

  body.nk-construction-theme *,
  body.nk-construction-theme *::before,
  body.nk-construction-theme *::after{
    box-sizing:border-box !important;
  }

  body.nk-construction-theme img,
  body.nk-construction-theme video,
  body.nk-construction-theme iframe,
  body.nk-construction-theme svg,
  body.nk-construction-theme canvas{
    max-width:100% !important;
  }

  body.nk-construction-theme .nk-con-container,
  body.nk-construction-theme .container,
  body.nk-construction-theme .wp-block-group__inner-container{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    padding-left:var(--nk-con-mobile-gutter) !important;
    padding-right:var(--nk-con-mobile-gutter) !important;
    margin-left:auto !important;
    margin-right:auto !important;
  }

  /* セクションはスマホで必ず縦方向に十分な余白を持たせる */
  body.nk-construction-theme .nk-con-section,
  body.nk-construction-theme .nk-con-single{
    padding-top:var(--nk-con-mobile-section-y) !important;
    padding-bottom:var(--nk-con-mobile-section-y) !important;
    overflow:visible !important;
    isolation:isolate !important;
  }

  body.nk-construction-theme .nk-con-section + .nk-con-section{
    margin-top:0 !important;
  }

  /* アニメーション初期状態による高さ計算ずれ・重なりをスマホでは止める */
  body.nk-construction-theme [data-nk-con-animate]{
    opacity:1 !important;
    transform:none !important;
    filter:none !important;
    clip-path:none !important;
    transition:none !important;
  }

  /* 見出しブロック：横並び/absolute/負の余白を全解除して縦積みに統一 */
  body.nk-construction-theme .nk-con-head{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    align-items:start !important;
    justify-items:stretch !important;
    gap:clamp(20px,5vw,30px) !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin:0 0 var(--nk-con-mobile-gap) !important;
    padding:0 !important;
    position:relative !important;
    overflow:visible !important;
    clear:both !important;
  }

  body.nk-construction-theme .nk-con-head__text{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:clamp(12px,3.6vw,18px) !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin:0 !important;
    padding:0 !important;
    position:static !important;
    overflow:visible !important;
  }

  body.nk-construction-theme .nk-con-head__actions{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin:0 !important;
    padding:0 !important;
    position:static !important;
    z-index:auto !important;
    clear:both !important;
  }

  body.nk-construction-theme .nk-con-eyebrow,
  body.nk-construction-theme .nk-con-title,
  body.nk-construction-theme .nk-con-lead,
  body.nk-construction-theme .nk-con-card__title,
  body.nk-construction-theme .nk-con-card__text,
  body.nk-construction-theme .nk-con-card__body p,
  body.nk-construction-theme .nk-con-news-item strong,
  body.nk-construction-theme .nk-con-news-item time{
    position:static !important;
    max-width:100% !important;
    min-width:0 !important;
    height:auto !important;
    max-height:none !important;
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
    word-break:normal !important;
    overflow-wrap:anywhere !important;
    line-break:strict !important;
  }

  body.nk-construction-theme .nk-con-eyebrow{
    display:block !important;
    margin:0 !important;
    font-size:clamp(.82rem,2.7vw,1rem) !important;
    line-height:1.45 !important;
    letter-spacing:.12em !important;
  }

  body.nk-construction-theme .nk-con-title{
    display:block !important;
    margin:0 !important;
    padding:0 !important;
    font-size:clamp(1.8rem,7vw,2.35rem) !important;
    line-height:1.34 !important;
    letter-spacing:.01em !important;
    text-wrap:auto !important;
  }

  body.nk-construction-theme .nk-con-lead{
    display:block !important;
    margin:0 !important;
    padding:0 !important;
    font-size:clamp(.98rem,3.35vw,1.08rem) !important;
    line-height:1.95 !important;
  }

  /* 見出し直後の一覧/カードには必ず安全距離を取る */
  body.nk-construction-theme .nk-con-head + .nk-con-grid,
  body.nk-construction-theme .nk-con-head + .nk-con-card-auto-grid,
  body.nk-construction-theme .nk-con-head + .nk-con-news-list,
  body.nk-construction-theme .nk-con-head + .nk-con-company-profile-grid,
  body.nk-construction-theme .nk-con-head + .nk-con-gallery-strip,
  body.nk-construction-theme .nk-con-head + .nk-con-beforeafter,
  body.nk-construction-theme .nk-con-head + .nk-con-ba-flow,
  body.nk-construction-theme .nk-con-head + .nk-con-process-flow{
    margin-top:0 !important;
    clear:both !important;
  }

  /* ボタン：見出しや本文に食い込まないフル幅CTAへ */
  body.nk-construction-theme .nk-con-btn,
  body.nk-construction-theme .nk-con-head__actions .nk-con-btn,
  body.nk-construction-theme .nk-con-hero__actions .nk-con-btn,
  body.nk-construction-theme .nk-con-cta__buttons .nk-con-btn,
  body.nk-construction-theme .nk-con-recruit__action .nk-con-btn{
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    min-height:56px !important;
    height:auto !important;
    margin:0 !important;
    padding:15px 18px !important;
    border-radius:999px !important;
    line-height:1.35 !important;
    white-space:normal !important;
    text-align:center !important;
    word-break:normal !important;
    overflow-wrap:anywhere !important;
    transform:none !important;
  }

  /* グリッド/フレックスをスマホでは1列に固定 */
  body.nk-construction-theme .nk-con-grid,
  body.nk-construction-theme .nk-con-grid--2,
  body.nk-construction-theme .nk-con-grid--3,
  body.nk-construction-theme .nk-con-grid--4,
  body.nk-construction-theme .nk-con-card-auto-grid,
  body.nk-construction-theme .nk-con-company-profile-grid,
  body.nk-construction-theme .nk-con-stats__inner,
  body.nk-construction-theme .nk-con-timeline,
  body.nk-construction-theme .nk-con-process-flow,
  body.nk-construction-theme .nk-con-process-row,
  body.nk-construction-theme .nk-con-process-row--top,
  body.nk-construction-theme .nk-con-process-row--bottom,
  body.nk-construction-theme .nk-con-license-cards,
  body.nk-construction-theme .nk-con-news-list,
  body.nk-construction-theme .nk-con-recruit-list,
  body.nk-construction-theme .nk-con-beforeafter,
  body.nk-construction-theme .nk-con-cta__inner{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:var(--nk-con-mobile-gap) !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }

  body.nk-construction-theme .nk-con-card-auto-grid > *,
  body.nk-construction-theme .nk-con-grid > *,
  body.nk-construction-theme .nk-con-process-row > *{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    flex:0 0 100% !important;
  }

  /* カード：高さ固定・テキスト省略・負の重ねを解除 */
  body.nk-construction-theme .nk-con-card,
  body.nk-construction-theme .nk-con-reason,
  body.nk-construction-theme .nk-con-step,
  body.nk-construction-theme .nk-con-stat,
  body.nk-construction-theme .nk-con-license-card,
  body.nk-construction-theme .nk-con-info-panel,
  body.nk-construction-theme .nk-con-company-profile-card,
  body.nk-construction-theme .nk-con-news-item,
  body.nk-construction-theme .nk-con-recruit-item,
  body.nk-construction-theme .nk-con-ba-card,
  body.nk-construction-theme .nk-con-ba-stage{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    min-height:0 !important;
    height:auto !important;
    max-height:none !important;
    margin-left:0 !important;
    margin-right:0 !important;
    transform:none !important;
  }

  body.nk-construction-theme .nk-con-card,
  body.nk-construction-theme .nk-con-company-profile-card,
  body.nk-construction-theme .nk-con-service-card,
  body.nk-construction-theme .nk-con-work-card{
    overflow:hidden !important;
    border-radius:24px !important;
  }

  body.nk-construction-theme .nk-con-card__image,
  body.nk-construction-theme .nk-con-work-card__image,
  body.nk-construction-theme .nk-con-company-profile-card .nk-con-card__image,
  body.nk-construction-theme .nk-con-service-card .nk-con-card__image{
    display:block !important;
    width:100% !important;
    min-height:clamp(210px,55vw,300px) !important;
    height:auto !important;
    aspect-ratio:16/10 !important;
    max-height:none !important;
    background-size:cover !important;
    background-position:center !important;
    position:relative !important;
  }

  body.nk-construction-theme .nk-con-card__body,
  body.nk-construction-theme .nk-con-work-card__body{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:clamp(12px,3.8vw,18px) !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    height:auto !important;
    max-height:none !important;
    margin:0 !important;
    padding:clamp(22px,5.4vw,30px) !important;
    position:relative !important;
    z-index:1 !important;
    overflow:visible !important;
  }

  body.nk-construction-theme .nk-con-work-card--overlay .nk-con-work-card__body{
    margin:0 !important;
    border-radius:0 !important;
    box-shadow:none !important;
    background:#fff !important;
  }

  body.nk-construction-theme .nk-con-card__meta,
  body.nk-construction-theme .nk-con-badgelist,
  body.nk-construction-theme .nk-con-recruit-points{
    display:flex !important;
    flex-wrap:wrap !important;
    align-items:flex-start !important;
    gap:8px !important;
    width:100% !important;
    max-width:100% !important;
    margin:0 !important;
    padding:0 !important;
  }

  body.nk-construction-theme .nk-con-chip,
  body.nk-construction-theme .nk-con-badgelist li,
  body.nk-construction-theme .nk-con-recruit-points span{
    display:inline-flex !important;
    width:auto !important;
    max-width:100% !important;
    min-height:34px !important;
    align-items:center !important;
    white-space:normal !important;
    line-height:1.35 !important;
    overflow-wrap:anywhere !important;
  }

  body.nk-construction-theme .nk-con-card__title,
  body.nk-construction-theme .nk-con-card__title a{
    display:block !important;
    margin:0 !important;
    font-size:clamp(1.18rem,5vw,1.48rem) !important;
    line-height:1.46 !important;
  }

  body.nk-construction-theme .nk-con-card__text,
  body.nk-construction-theme .nk-con-card__body p,
  body.nk-construction-theme .nk-con-work-card__story span{
    display:block !important;
    margin:0 !important;
    font-size:clamp(.96rem,3.8vw,1.04rem) !important;
    line-height:1.9 !important;
  }

  body.nk-construction-theme .nk-con-card__link{
    display:inline-flex !important;
    align-items:center !important;
    justify-content:flex-start !important;
    width:auto !important;
    min-height:44px !important;
    margin:0 !important;
    line-height:1.35 !important;
    white-space:normal !important;
  }

  body.nk-construction-theme .nk-con-work-card__story,
  body.nk-construction-theme .nk-con-work-card__story div{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:8px !important;
    width:100% !important;
  }

  body.nk-construction-theme .nk-con-work-card__story b{
    width:max-content !important;
  }

  /* NEWS */
  body.nk-construction-theme .nk-con-news-list{
    margin:0 !important;
  }

  body.nk-construction-theme .nk-con-news-item{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:8px !important;
    padding:clamp(18px,5vw,24px) !important;
    border-radius:20px !important;
    line-height:1.6 !important;
    overflow:visible !important;
  }

  body.nk-construction-theme .nk-con-news-item strong{
    font-size:clamp(1.08rem,4.8vw,1.38rem) !important;
    line-height:1.55 !important;
  }

  /* 施工フロー/Before After の省略・矢印系をスマホで解除 */
  body.nk-construction-theme #nk-con-beforeafter .nk-con-ba-step p,
  body.nk-construction-theme #nk-con-beforeafter .nk-con-ba-card p{
    display:block !important;
    -webkit-line-clamp:unset !important;
    -webkit-box-orient:initial !important;
    overflow:visible !important;
    max-height:none !important;
  }

  body.nk-construction-theme #nk-con-beforeafter .nk-con-ba-card::before,
  body.nk-construction-theme #nk-con-beforeafter .nk-con-ba-card::after,
  body.nk-construction-theme .nk-con-process-turn,
  body.nk-construction-theme .nk-con-process-turn::before,
  body.nk-construction-theme .nk-con-process-turn::after,
  body.nk-construction-theme .nk-con-process-row .nk-con-step::before,
  body.nk-construction-theme .nk-con-process-row .nk-con-step::after{
    display:none !important;
    content:none !important;
  }

  /* 採用：黒文字指定と濃色背景の衝突を避ける */
  body.nk-construction-theme #nk-con-recruit .nk-con-recruit__layout,
  body.nk-construction-theme #nk-con-recruit .nk-con-container{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:var(--nk-con-mobile-gap) !important;
  }

  body.nk-construction-theme #nk-con-recruit .nk-con-recruit__copy{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:16px !important;
    padding:clamp(22px,5.8vw,30px) !important;
    border-radius:24px !important;
    background:#fff !important;
    color:#101925 !important;
    text-shadow:none !important;
    overflow:visible !important;
  }

  body.nk-construction-theme #nk-con-recruit .nk-con-title,
  body.nk-construction-theme #nk-con-recruit .nk-con-title *,
  body.nk-construction-theme #nk-con-recruit .nk-con-recruit__copy strong{
    color:#000 !important;
    text-shadow:none !important;
  }

  body.nk-construction-theme #nk-con-recruit .nk-con-eyebrow,
  body.nk-construction-theme #nk-con-recruit .nk-con-lead,
  body.nk-construction-theme #nk-con-recruit .nk-con-recruit__note,
  body.nk-construction-theme #nk-con-recruit .nk-con-recruit__copy p{
    color:#334155 !important;
    text-shadow:none !important;
  }

  /* ヒーローと統計 */
  body.nk-construction-theme .nk-con-hero{
    min-height:auto !important;
    display:block !important;
    overflow:hidden !important;
  }

  body.nk-construction-theme .nk-con-hero__content{
    width:100% !important;
    max-width:100% !important;
    padding-top:clamp(78px,14vw,110px) !important;
    padding-bottom:clamp(50px,10vw,74px) !important;
  }

  body.nk-construction-theme .nk-con-hero__title{
    font-size:clamp(2rem,9vw,3rem) !important;
    line-height:1.18 !important;
    max-width:100% !important;
  }

  body.nk-construction-theme .nk-con-hero__lead{
    font-size:clamp(.98rem,3.8vw,1.08rem) !important;
    line-height:1.9 !important;
    max-width:100% !important;
  }

  body.nk-construction-theme .nk-con-hero__actions,
  body.nk-construction-theme .nk-con-cta__buttons{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:12px !important;
    width:100% !important;
  }

  body.nk-construction-theme .nk-con-hero__panel{
    position:relative !important;
    inset:auto !important;
    width:auto !important;
    max-width:100% !important;
    margin:0 var(--nk-con-mobile-gutter) clamp(28px,6vw,42px) !important;
  }

  body.nk-construction-theme .nk-con-stats{
    margin-top:0 !important;
    padding-top:24px !important;
    padding-bottom:24px !important;
  }

  body.nk-construction-theme .nk-con-stat{
    padding:22px !important;
  }

  /* 画像ギャラリーは横スクロールではなくカード1列表示 */
  body.nk-construction-theme .nk-con-gallery-strip,
  body.nk-construction-theme .nk-con-gallery-track{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:18px !important;
    width:100% !important;
    max-width:100% !important;
    overflow:visible !important;
    mask-image:none !important;
    -webkit-mask-image:none !important;
    animation:none !important;
    transform:none !important;
  }

  body.nk-construction-theme .nk-con-gallery-card{
    min-width:0 !important;
    width:100% !important;
  }

  body.nk-construction-theme .nk-con-gallery-card img{
    height:auto !important;
    aspect-ratio:16/10 !important;
    object-fit:cover !important;
  }

  /* 下部固定CTA：本文にかぶる印象を抑える高さ・余白に再設計 */
  body.nk-construction-theme .nk-con-mobile-cta[style]{
    position:fixed !important;
    left:0 !important;
    right:0 !important;
    bottom:0 !important;
    z-index:99999 !important;
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:10px !important;
    min-height:var(--nk-con-mobile-cta-height) !important;
    padding:10px max(18px,env(safe-area-inset-left,0px)) calc(10px + env(safe-area-inset-bottom,0px)) max(18px,env(safe-area-inset-right,0px)) !important;
    background:rgba(255,255,255,.98) !important;
    border-top:1px solid rgba(15,23,42,.12) !important;
    box-shadow:0 -14px 34px rgba(15,37,63,.18) !important;
    backdrop-filter:blur(16px) !important;
    -webkit-backdrop-filter:blur(16px) !important;
  }

  body.nk-construction-theme .nk-con-mobile-cta a{
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    min-height:52px !important;
    padding:10px 12px !important;
    border-radius:999px !important;
    font-size:clamp(.98rem,3.7vw,1.08rem) !important;
    line-height:1.2 !important;
    font-weight:900 !important;
    text-align:center !important;
    text-decoration:none !important;
    white-space:normal !important;
  }

  body.nk-construction-theme .nk-con-footer-home,
  body.nk-construction-theme footer,
  body.nk-construction-theme .site-footer{
    margin-bottom:var(--nk-con-mobile-bottom-space) !important;
  }
}

@media (max-width: 430px){
  :root{
    --nk-con-mobile-header-height:60px;
    --nk-con-mobile-gutter:16px;
    --nk-con-mobile-section-y:58px;
  }

  body.nk-construction-theme .nk-con-title{
    font-size:clamp(1.62rem,8.2vw,2rem) !important;
    line-height:1.38 !important;
  }

  body.nk-construction-theme .nk-con-card__image,
  body.nk-construction-theme .nk-con-work-card__image,
  body.nk-construction-theme .nk-con-company-profile-card .nk-con-card__image,
  body.nk-construction-theme .nk-con-service-card .nk-con-card__image{
    min-height:clamp(188px,54vw,230px) !important;
  }

  body.nk-construction-theme .nk-con-mobile-header__brand{
    max-width:calc(100vw - 150px) !important;
  }

  body.nk-construction-theme .nk-con-mobile-header__tel{
    min-height:40px !important;
    padding-left:10px !important;
    padding-right:10px !important;
    font-size:.78rem !important;
  }

  body.nk-construction-theme .nk-con-mobile-header__toggle{
    width:44px !important;
    height:44px !important;
  }
}

@media (max-width: 360px){
  :root{
    --nk-con-mobile-gutter:14px;
  }

  body.nk-construction-theme .nk-con-title{
    font-size:1.52rem !important;
  }

  body.nk-construction-theme .nk-con-mobile-cta[style]{
    gap:8px !important;
    padding-left:12px !important;
    padding-right:12px !important;
  }

  body.nk-construction-theme .nk-con-mobile-cta a{
    font-size:.94rem !important;
    min-height:48px !important;
  }
}
