/* ==========================================
   基本設定・リセット
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  color: #333;
  background-color: #f7f9fa;
  line-height: 1.7;
}

/* ==========================================
   モバイルヘッダー & オーバーレイ
   ========================================== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 56px;
  background-color: #1a252f;
  color: #fff;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
}

.menu-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  margin-right: 16px;
}

.mobile-title {
  font-size: 1.1rem;
  font-weight: bold;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

.overlay.show {
  display: block;
}

/* ==========================================
   全体レイアウト & サイドバー
   ========================================== */
.layout {
  display: flex;
  min-height: 100vh;
}

/* サイドバー (PC表示) */
.sidebar {
  width: 240px;
  background-color: #2c3e50;
  color: #ecf0f1;
  padding: 24px 16px;
  flex-shrink: 0;
}

.sidebar h2 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid #34495e;
}

.sidebar nav a {
  display: block;
  color: #bdc3c7;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  transition: background-color 0.2s, color 0.2s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background-color: #34495e;
  color: #fff;
  font-weight: bold;
}

/* ==========================================
   メインコンテンツエリア (直列配置)
   ========================================== */
.content {
  flex: 1;
  display: flex;
  flex-direction: column; /* 画像とカードを直列（上から下）に配置 */
  align-items: center;     /* 中央寄せ */
  gap: 24px;              /* 画像と文章カードの間の余白 */
  width: 100%;
  padding: 32px 24px;
  box-sizing: border-box;
}

/* ----------------------------------
   トップ画像エリア (.hero-section)
---------------------------------- */
.hero-section {
  width: 100%;
  max-width: 800px; /* カードの最大幅と揃えて統一感を演出 */
}

.hero-img {
  width: 100%;
  height: auto;     /* 縦横比を維持し見切れを防止 */
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ----------------------------------
   メインカード
---------------------------------- */
.content-card {
  width: 100%;
  max-width: 800px;
  background-color: #ffffff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ----------------------------------
   文章・テキスト要素の可読性向上！（余白設定）
---------------------------------- */
.content-card p {
  margin-bottom: 1.2rem;
  line-height: 1.7;
}

.content-card h1,
.content-card h2,
.content-card h3,
.content-card h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
}

/* 最初に来る見出しの不要な上余白を除去 */
.content-card h1:first-child,
.content-card h2:first-child,
.content-card h3:first-child,
.content-card h4:first-child {
  margin-top: 0;
}

/* リスト（箇条書き）の余白とインデント */
.content-card ul,
.content-card ol {
  margin-bottom: 1.2rem;
  padding-left: 1.5rem;
}

.content-card li {
  margin-bottom: 0.4rem;
}

/* 最後の要素の下余白をリセット */
.content-card > *:last-child,
.main-column > *:last-child,
.sub-column > *:last-child {
  margin-bottom: 0;
}

/* ----------------------------------
   2カラムレイアウト設定
---------------------------------- */
.two-column-wrapper {
  display: flex;
  gap: 32px;
}

.main-column {
  flex: 2;
}

.sub-column {
  flex: 1;
  border-left: 1px solid #eee;
  padding-left: 24px;
}

.sub-heading {
  font-size: 1.1rem;
  margin-bottom: 12px;
  padding-bottom: 4px;
  border-bottom: 2px solid #3498db;
}

.sub-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: 24px;
}

.sub-list li {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.sub-list a {
  color: #3498db;
  text-decoration: none;
}

.sub-list a:hover {
  text-decoration: underline;
}

/* ==========================================
   P名刺の集合知 (pbc.html) 用スタイル
   ========================================== */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.grid-item {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.grid-item:hover {
  transform: translateY(-4px);
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* モーダル表示 */
.image-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.image-modal.active {
  display: flex;
}

.modal-content-wrapper img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
  object-fit: contain;
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  font-size: 24px;
  padding: 16px 12px;
  cursor: pointer;
  border-radius: 4px;
}

.prev-btn { left: 20px; }
.next-btn { right: 20px; }

/* ==========================================
   レスポンシブ対応 (スマホ・タブレット)
   ========================================== */
@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .layout {
    padding-top: 56px;
  }

  .sidebar {
    position: fixed;
    top: 56px;
    left: -240px;
    height: calc(100vh - 56px);
    z-index: 95;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }

  .content {
    padding: 12px; /* 周囲の余白を調整 */
    background-size: auto 100%; /* 高さに合わせて拡大・縮小 */
    background-position: center top; /* 中央上部を基準に配置 */
  }

  .two-column-wrapper {
    flex-direction: column;
    gap: 20px;
  }

  .sub-column {
    border-left: none;
    border-top: 1px solid #eee;
    padding-left: 0;
    padding-top: 20px;
  }

  /* 白枠カードの幅とパディング調整 */
  .content-card {
    width: 100%;
    max-width: 100%;
    padding: 16px; /* スマホ用に中の余白を少し小さく設定 */
    box-sizing: border-box;
  }
.content {
    padding: 12px;
    background-size: contain;
    background-position: center top;
  }

  .content-card {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    box-sizing: border-box;
  }

  /* ▼ ここを追加：スマホ時に名刺グリッドの列数を1列にする、または大きさを調整する ▼ */
  .image-grid {
    grid-template-columns: repeat(2, 1fr); /* スマホでは2列に並べる（1列にしたい場合は 1fr のみ） */
    gap: 10px;
  }

  .grid-item {
    width: 100%;
  }

  /* モーダルやコンテンツ内の画像が画面からはみ出さないようにする制限 */
  img {
    max-width: 100%;
    height: auto;
  }
}