/* ============================================================
   Terra Design — Responsive CSS
   responsive.css  (loaded after inline <style>)
   Breakpoints:
     Tablet  : max-width 1024px
     Mobile  : max-width 768px
     Small   : max-width 480px
   ============================================================ */

/* ===== DESKTOP OVERRIDE (>1024px) ===== */
/* インラインCSS の @media(max-width:960px){nav.main{display:none}} を上書き */
@media (min-width: 1025px) {
  nav.main#mainnav {
    display: flex !important;
    position: static;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 30px;
    padding: 0;
    z-index: auto;
    inset: auto;
  }

  nav.main#mainnav a {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    color: var(--ink-soft);
    width: auto;
    max-width: none;
    text-align: left;
    border-bottom: none;
  }

  nav.main#mainnav a .jp { display: inline-block; font-size: 13px; font-family: "Noto Sans JP", sans-serif; font-weight: 500; letter-spacing: normal; color: var(--ink-soft); }
  nav.main#mainnav a .en { display: none; font-family: "Cormorant Garamond", serif; font-size: 15px; letter-spacing: 0.08em; color: var(--accent); margin-top: 0; }
  nav.main#mainnav a:hover .jp { display: none; color: inherit; }
  nav.main#mainnav a:hover .en { display: inline-block; color: var(--accent); }

  nav.main#mainnav a::after {
    display: block;
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: right;
    transition: 0.3s;
  }
  nav.main#mainnav a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
  }

  /* デスクトップではナビ内CTAを非表示 */
  .nav-line-cta { display: none; }

  /* ハンバーガーボタンを完全非表示 */
  #ham-btn { display: none !important; }
}

/* ===== HAMBURGER MENU BASE ===== */

/* ハンバーガーボタン — デスクトップでは完全非表示 */
#ham-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  z-index: 10000;
  position: relative;
  transition: border-color 0.2s;
}
#ham-btn:hover { border-color: var(--accent); }

#ham-btn .bar {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

/* ハンバーガー → × 変形 */
body.nav-open #ham-btn .bar:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}
body.nav-open #ham-btn .bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
body.nav-open #ham-btn .bar:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* オーバーレイナビ — モバイル時の全画面白メニュー */
@media (max-width: 1024px) {
  #ham-btn {
    display: flex;
    order: 10;
  }
  .topbar-inner .top-ctas { order: 5; }

  nav.main#mainnav {
    display: none !important;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #ffffff !important;
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 60px 32px 48px;
    overflow-y: auto;
    box-shadow: none;
    border: none;
  }

  body.nav-open nav.main#mainnav {
    display: flex !important;
  }

  body.nav-open {
    overflow: hidden;
  }

  nav.main#mainnav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    font-size: 22px;
    color: var(--ink) !important;
    border-bottom: 1px solid var(--line);
    width: 100%;
    max-width: 320px;
    text-align: center;
    transition: color 0.2s;
  }
  nav.main#mainnav a:first-child { border-top: 1px solid var(--line); }

  nav.main#mainnav a .jp {
    display: inline-block !important;
    font-family: "Shippori Mincho", serif;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--ink);
  }

  nav.main#mainnav a .en {
    display: inline-block !important;
    font-family: "Cormorant Garamond", serif;
    font-size: 10px;
    letter-spacing: 0.28em;
    color: var(--muted);
    margin-top: 3px;
    text-transform: uppercase;
  }

  nav.main#mainnav a::after {
    display: none;
  }

  nav.main#mainnav a:hover .jp {
    color: var(--accent) !important;
  }

  nav.main#mainnav a:hover .en {
    color: rgba(27, 107, 58, 0.6) !important;
  }

  /* ナビ内 LINE & 無料相談 CTAボタン */
  .nav-line-cta {
    margin-top: 36px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    width: 100%;
    max-width: 320px;
  }

  .nav-line-cta a {
    border: none !important;
    padding: 16px 32px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 999px !important;
    font-family: "Noto Sans JP", sans-serif !important;
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

/* ===== BREAKPOINT: TABLET (max-width: 1024px) ===== */

@media (max-width: 1024px) {

  /* --- 全体レイアウト --- */
  .wrap { padding: 0 24px; }
  .wrap-narrow { padding: 0 24px; }
  section { padding: 80px 0; }
  section.tight { padding: 64px 0; }

  /* --- セクションヘッダー --- */
  .sec-head {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 48px;
  }
  .sec-title { font-size: 34px; }
  .sec-sub { justify-self: start; max-width: 100%; }

  /* --- ヒーロー --- */
  h1.hero-title { font-size: 36px; line-height: 1.4; }
  .hero-content { padding: 90px 0 80px; }
  .hero-badge { display: none; }

  /* --- onestop-bar --- */
  .os-steps { gap: 4px; }
  .os-step { min-width: 60px; padding: 8px 4px; }
  .os-step-name { font-size: 13px; }
  .os-step-sub { font-size: 9px; }
  .os-arr { font-size: 12px; }

  /* --- ISSUES グリッド (3列 → 2列) --- */
  .issue-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .issue-cat { grid-column: 1 / -1; }

  /* --- サービスタブ --- */
  .svc-tabs {
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
  }
  .svc-tabs::-webkit-scrollbar { display: none; }
  .svc-tab { flex-shrink: 0; }

  /* サービスパネル 3列 → 2列 */
  .svc-panel { grid-template-columns: repeat(2, 1fr) !important; }

  /* --- 業種別ソリューション 3列 → 2列 --- */
  .isol-grid { grid-template-columns: repeat(2, 1fr); }
  .isol h4 { font-size: 14px; }
  .isol-body { min-width: 0; overflow: hidden; }

  /* --- プロセス 5列 → 3列 --- */
  .process-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px;
  }
  .process-grid::before { display: none; }
  .step { text-align: center; padding: 0 8px; }

  /* --- 事例グリッド 3列 → 2列 --- */
  .case-grid { grid-template-columns: repeat(2, 1fr); }

  /* --- 業種グリッド 4列 → 3列 --- */
  .ind-grid { grid-template-columns: repeat(3, 1fr) !important; }

  /* --- WPブロググリッド 3列 → 2列 --- */
  .wp-grid { grid-template-columns: repeat(2, 1fr); }
  .wp-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

  /* --- CTA split --- */
  .cta-split-grid { grid-template-columns: 1fr !important; }
  .cta-box { padding: 60px 40px; }

  /* --- フッター 4列 → 2列 --- */
  .foot-top { grid-template-columns: 1fr 1fr; gap: 32px; }

  /* --- 姉妹サイト 4列 → 2列 --- */
  .sister-grid { grid-template-columns: repeat(2, 1fr); }

  /* --- contact form 2列 → 1列 --- */
  .cf-grid { grid-template-columns: 1fr; }
  .cf-field.full { grid-column: 1; }

  /* --- top-ctas サイズ調整 --- */
  .top-ctas .btn-ghost { display: none; }
  .btn-line { padding: 9px 14px; font-size: 12px; }
}

/* ===== BREAKPOINT: MOBILE (max-width: 768px) ===== */

@media (max-width: 768px) {

  /* --- ベース --- */
  body { font-size: 14px; }
  .wrap { padding: 0 16px; }
  .wrap-narrow { padding: 0 16px; }
  section { padding: 56px 0; }
  section.tight { padding: 48px 0; }

  /* --- トップバー --- */
  .topbar-inner { height: 58px; padding: 0 16px; }
  .logo img { height: 26px; }

  /* --- ヒーロー --- */
  .hero { min-height: 100svh; }
  .hero-content { padding: 80px 0 80px; }
  h1.hero-title { font-size: 26px; line-height: 1.5; margin-bottom: 20px; }
  h1.hero-title em { padding: 0 2px; }
  .hero-lead { font-size: 13.5px; line-height: 1.9; margin-bottom: 22px; }
  .eyebrow { font-size: 10px; margin-bottom: 14px; }

  /* hero CTAボタン スマホでは非表示（ヘッダーのLINEボタンを使用） */
  .hero-ctas { display: none; }

  /* --- onestop-bar コンパクト化 --- */
  .onestop-bar { padding: 16px 14px; margin-top: 24px; }
  .os-eyebrow { font-size: 8.5px; letter-spacing: 0.18em; margin-bottom: 10px; }
  .os-steps { gap: 2px; }
  .os-step {
    min-width: 48px;
    padding: 6px 3px;
    flex: 1;
  }
  .os-icon { width: 22px; height: 22px; }
  .os-step-name { font-size: 11px; }
  .os-step-sub { display: none; }
  .os-arr { font-size: 10px; margin-bottom: 4px; }
  .os-bottom { font-size: 10.5px; margin-top: 10px; padding-top: 8px; }

  /* os-steps 2列グリッドに */
  .os-steps {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: center;
  }

  /* --- セクションヘッダー --- */
  .sec-head { margin-bottom: 32px; gap: 12px; }
  .sec-title { font-size: 24px; line-height: 1.45; }
  .sec-eng { font-size: 11px; }
  .sec-sub { font-size: 13px; }

  /* --- ISSUESグリッド 2列 → 1列 --- */
  .issue-grid { grid-template-columns: 1fr; gap: 12px; }
  .issue-cat { margin-top: 12px; padding-top: 20px; }
  .issue { padding: 24px 20px; }
  .issue h3 { font-size: 17px; }
  .issue p { font-size: 12.5px; }
  .issue-resolve h3 { font-size: 22px; }

  /* --- サービスタブ: スマホ用 2列グリッドボタン化 --- */
  .svc-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    overflow: visible;
    white-space: normal;
    flex-wrap: unset;
    border-bottom: none;
    padding: 0;
    margin-bottom: 24px;
  }
  .svc-tab {
    flex-shrink: unset;
    white-space: normal;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    border-bottom: 1px solid var(--line) !important;
    margin-bottom: 0 !important;
  }
  .svc-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent) !important;
  }
  .svc-tab.active .count { background: #fff; color: var(--accent); }
  .svc-tab-en { display: none; }
  .svc-tab .count { font-size: 10px; padding: 1px 6px; }
  /* アニメーション無効化 */
  .svc-tab:not(.active) { animation: none; }

  /* サービスパネル 1列 */
  .svc-panel { grid-template-columns: 1fr !important; }
  .svc { padding: 20px 16px; }
  .svc h4 { font-size: 15px; }
  .svc p { font-size: 12.5px; }

  /* --- 業種別ソリューション 2列 → 1列 --- */
  .isol-grid { grid-template-columns: 1fr !important; gap: 8px; }
  .isol {
    grid-template-columns: 52px 1fr;
    gap: 12px;
    padding: 14px 12px;
    min-height: auto;
    overflow: hidden;
  }
  .isol-thumb { width: 52px; height: 52px; flex-shrink: 0; }
  .isol-thumb svg { width: 28px; height: 28px; }
  .isol h4 { font-size: 13px; margin: 0 0 2px; line-height: 1.4; word-break: keep-all; }
  .isol-en { font-size: 9px; margin-bottom: 4px; white-space: normal; word-break: break-word; }
  .isol p { display: none; }
  .isol-foot { margin-top: 6px; padding-top: 6px; font-size: 10px; }
  .isol-status { font-size: 8px; padding: 2px 6px; }

  /* --- プロセス 3列 → 1列縦並び --- */
  .process-grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
  .process-grid::before {
    top: 0; bottom: 0;
    left: 35px; right: auto;
    width: 2px; height: auto;
    background: repeating-linear-gradient(180deg, rgba(27,107,58,.35) 0 8px, transparent 8px 14px);
  }
  .step {
    display: grid;
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto;
    column-gap: 16px;
    row-gap: 6px;
    text-align: left;
    align-items: flex-start;
  }
  .step .step-n {
    grid-row: 1 / 3;
    align-self: start;
    margin: 0;
    width: 60px;
    height: 60px;
  }
  .step-n .step-num { font-size: 22px !important; }
  .step h4 { font-size: 16px; text-align: left; margin: 0; align-self: end; }
  .step p { font-size: 12.5px; text-align: left; margin: 0; align-self: start; }

  /* --- CTA split --- */
  .cta-box { padding: 48px 24px; }
  .cta-box h3 { font-size: 24px; }
  .cta-box p { font-size: 13.5px; }

  /* --- ブロググリッド 2列 → 1列 --- */
  .wp-grid { grid-template-columns: 1fr !important; }
  .wp-grid.cols-2 { grid-template-columns: 1fr !important; }
  .wp-card { flex-direction: column; }

  /* --- 業種グリッド 3列 → 2列 (スマホ) --- */
  .ind-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
  .ind { padding: 14px 10px; }
  .ind-name { font-size: 11px; line-height: 1.4; }
  .ind-ic { width: 28px; height: 28px; }

  /* --- 事例グリッド 2列 → 1列 --- */
  .case-grid { grid-template-columns: 1fr !important; gap: 16px; }

  /* --- FAQ --- */
  .q summary { padding: 18px 16px; font-size: 13.5px; gap: 12px; }
  .q-body { padding: 4px 16px 18px 50px; font-size: 13px; }
  .q-mark { font-size: 18px; }

  /* --- フッター 2列 → 1列 --- */
  .foot-top { grid-template-columns: 1fr !important; gap: 28px; }
  .foot-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    font-size: 11px;
  }

  /* --- LINE GIFT --- */
  .line-gift { padding: 48px 0; }
  .line-gift-content { padding: 32px 20px; }
  .line-gift-title { font-size: 22px; }
  .line-gift-title .lg-line-1 { font-size: 15px; }
  .line-gift-title .lg-line-2 { font-size: 22px; }
  .line-gift-title .lg-line-3 { font-size: 16px; }
  .lg-btn-main {
    padding: 18px 20px;
    font-size: 13px;
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  /* --- フローティングLINEボタン --- */
  .floating-line { bottom: 16px; right: 16px; gap: 8px; }
  .fl-btn { padding: 12px 16px; font-size: 12px; }

  /* --- ポートフォリオモザイク --- */
  .pf-mosaic {
    grid-template-columns: repeat(3, 1fr) !important;
    grid-auto-rows: 90px;
    gap: 4px;
  }
  .pf-lg { grid-column: span 1 !important; grid-row: span 1 !important; }
  .pf-tall { grid-row: span 1 !important; }
  .pf-wide { grid-column: span 2 !important; }

  /* --- スクロールトップ --- */
  #scroll-top { right: 16px; bottom: 80px; }

  /* --- 実績ストリップ --- */
  .ach-inner { flex-wrap: wrap; }
  .ach-item { flex: 0 0 50%; padding: 18px 12px; }
  .ach-num { font-size: 34px; }
  .ach-sep { display: none; }

  /* --- ケーススタッツバー --- */
  .case-stats-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .cs-n { font-size: 24px; }

  /* --- 姉妹サイトグリッド --- */
  .sister-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* ---- btn-xl / btn-lg ---- */
  .btn-xl { padding: 14px 22px; font-size: 13px; }
  .btn-lg { padding: 12px 18px; font-size: 12.5px; }

  /* 一般ヘッダーを隠す（960pxで既にあるが念のため補完）*/
  nav.main { display: none; }
}

/* ===== BREAKPOINT: SMALL MOBILE (max-width: 480px) ===== */

@media (max-width: 480px) {

  /* --- ヒーロー --- */
  h1.hero-title { font-size: 22px; }
  .hero-content { padding: 72px 0 72px; }
  .hero-lead { font-size: 13px; }

  /* hero CTAボタン 480px以下でも非表示 */

  /* --- onestop-bar さらにコンパクト --- */
  .os-steps {
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  }
  .os-icon { width: 18px; height: 18px; }
  .os-step-name { font-size: 9.5px; }
  .os-arr { font-size: 8px; }
  .os-bottom { font-size: 9px; }

  /* --- セクションタイトル --- */
  .sec-title { font-size: 20px; }

  /* --- サービスタブ: 1列にする --- */
  .svc-tabs { grid-template-columns: 1fr; }

  /* --- 業種グリッド 2列維持 (文字小さく) --- */
  .ind-name { font-size: 10px; }
  .ind { padding: 12px 8px; gap: 10px; }

  /* --- CTA box --- */
  .cta-box { padding: 40px 16px; }
  .cta-box h3 { font-size: 20px; }

  /* --- ブログカード --- */
  .wp-card-title { font-size: 14px; }

  /* --- フッター --- */
  footer { padding: 36px 0 20px; }
  .foot-contact strong { font-size: 16px; }

  /* --- LINE GIFT --- */
  .line-gift-content { padding: 28px 16px; }
  .line-gift-title { font-size: 18px; }
  .line-gift-title .lg-line-2 { font-size: 18px; }
  .line-gift-title .lg-line-3 { font-size: 14px; }
  .line-gift-box { padding: 16px 14px; }
  .lg-d-item { grid-template-columns: 38px 1fr; gap: 10px; }
  .lg-d-num { font-size: 20px; }

  /* --- FAQ --- */
  .q summary { padding: 16px 14px; font-size: 13px; }
  .q-body { padding: 4px 14px 16px 44px; font-size: 12.5px; }

  /* --- ナビオーバーレイ（小型スマホ）--- */
  nav.main#mainnav a {
    font-size: 18px;
    padding: 14px 0;
  }
  nav.main#mainnav a .jp { font-size: 17px; }
}
