/* InterフォントをGoogle Fontsからインポート */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/*
  CSS設計原則:
  1. CSS変数で共通値を管理 (--primary-color, --text-color, etc.)
  2. インデントは2スペース
  3. セレクタはケバブケース (e.g., .main-content)
  4. レスポンシブ対応はモバイルファーストで記述
*/

:root {
  --primary-color: #007BFF; /* エレクトリックブルー */
  --primary-hover-color: #0056b3;
  --background-color: #121212; /* ダークモード基調 */
  --surface-color: #1E1E1E;   /* カードやヘッダーの背景 */
  --text-color: #E0E0E0;      /* 基本テキスト */
  --heading-color: #FFFFFF;    /* 見出し */
  --border-color: #333333;
  --header-height: 70px;
  --font-family: 'Inter', sans-serif;
}

/* --- 基本スタイル --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--heading-color);
  font-weight: 700;
  margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

p {
  margin-bottom: 1rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--primary-hover-color);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 0;
}

/* --- ヘッダー & ナビゲーション --- */
.header {
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  padding: 0 5%;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo a {
  color: var(--heading-color);
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-menu {
  display: flex;
  list-style: none;
}

.nav-item {
  margin-left: 2rem;
}

.nav-link {
  color: var(--text-color);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.3s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary-color);
}

.hamburger {
  display: none;
  cursor: pointer;
}

.bar {
  display: block;
  width: 25px;
  height: 3px;
  margin: 5px auto;
  background-color: var(--heading-color);
  transition: all 0.3s ease-in-out;
}

/* --- ヒーローセクション --- */
.hero {
  background-size: cover;
  background-position: center;
  color: white;
  text-align: center;
  padding: 6rem 1rem;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

/* --- ボタン --- */
.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  border-radius: 5px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: 1px solid var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-hover-color);
  color: white;
  text-decoration: none;
  transform: translateY(-2px);
}

/* --- カード --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 123, 255, 0.1);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-content {
  padding: 1.5rem;
}

.card h3 {
  font-size: 1.2rem;
  margin-top: 0;
}

.card p {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* --- 2カラムレイアウト (メインコンテンツ + サイドバー) --- */
main.container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

/* --- メインコンテンツ --- */
.main-content {
  background-color: var(--surface-color);
  padding: 2rem;
  border-radius: 8px;
}

/* --- サイドバー --- */
.sidebar {
  background-color: var(--surface-color);
  padding: 1.5rem;
  border-radius: 8px;
  position: sticky;
  top: calc(var(--header-height) + 1rem);
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section h3 {
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  color: var(--heading-color);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
}

.toc-list, .related-articles {
  list-style: none;
  padding: 0;
}

.toc-list li, .related-articles li {
  margin-bottom: 0.6rem;
}

.toc-link, .related-articles a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s ease;
  display: block;
  padding: 0.3rem 0;
}

.toc-link:hover, .related-articles a:hover {
  color: var(--primary-color);
  text-decoration: none;
}

.ad-space {
  background-color: var(--background-color);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}

.ad-label {
  font-size: 0.75rem;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

/* --- フッター --- */
.footer {
  background-color: var(--surface-color);
  border-top: 1px solid var(--border-color);
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer-links {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

/* --- レスポンシブ対応 (モバイルファースト) --- */
@media (max-width: 768px) {
  /* モバイルでは1カラム、サイドバーを本文の前に表示 */
  main.container {
    display: flex;
    flex-direction: column-reverse;
    gap: 1.5rem;
  }

  .sidebar {
    position: static;
    order: -1; /* サイドバーを最初に表示 */
  }

  .main-content {
    order: 1; /* 本文を後に表示 */
  }

  .nav-menu {
    position: fixed;
    left: -100%;
    top: var(--header-height);
    flex-direction: column;
    background-color: var(--surface-color);
    width: 100%;
    height: calc(100vh - var(--header-height));
    text-align: center;
    transition: 0.3s;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-item {
    margin: 1.5rem 0;
  }

  .hamburger {
    display: block;
  }

  .hamburger.active .bar:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  h1 { font-size: 2rem; }
  .hero h1 { font-size: 2.5rem; }
  .hero p { font-size: 1rem; }
}