/* ========================================
   LearnOpenGL 日本語ドリル技術書 — カスタムCSS
   ======================================== */

/* --- カラー変数 --- */
:root {
  --theme-color: #4a90d9;
  --sidebar-width: 280px;
  --sidebar-bg: #f8f9fa;
  --code-bg: #1e1e2e;
  --heading-color: #2c3e50;
  --accent-green: #27ae60;
  --accent-yellow: #f39c12;
  --accent-orange: #e67e22;
  --accent-red: #e74c3c;
  --accent-purple: #9b59b6;
}

/* --- サイドバー --- */
.sidebar {
  background-color: var(--sidebar-bg) !important;
  border-right: 1px solid #e0e0e0;
}

.sidebar ul li a {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #555;
  transition: color 0.2s;
}

.sidebar ul li a:hover {
  color: var(--theme-color);
  text-decoration: none;
}

.sidebar ul li.active > a {
  color: var(--theme-color);
  font-weight: 600;
  border-right: 3px solid var(--theme-color);
}

/* --- コンテンツ --- */
.markdown-section {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

.markdown-section h1 {
  color: var(--heading-color);
  border-bottom: 3px solid var(--theme-color);
  padding-bottom: 0.4rem;
  margin-top: 2rem;
}

.markdown-section h2 {
  color: var(--heading-color);
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.3rem;
  margin-top: 2.5rem;
}

.markdown-section h3 {
  color: #34495e;
  margin-top: 1.8rem;
}

/* --- blockquote（目標ブロック） --- */
.markdown-section blockquote {
  background: linear-gradient(135deg, #e8f4fd, #f0f7ff);
  border-left: 4px solid var(--theme-color);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  color: #2c3e50;
}

.markdown-section blockquote p {
  margin: 0;
}

/* --- コードブロック --- */
.markdown-section pre {
  background: var(--code-bg) !important;
  border-radius: 8px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.markdown-section code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Source Code Pro', monospace;
  font-size: 0.88rem;
}

.markdown-section p code,
.markdown-section li code,
.markdown-section td code {
  background: #f0f0f0;
  color: #e74c3c;
  border-radius: 3px;
  padding: 0.15em 0.4em;
  font-size: 0.85rem;
}

/* --- テーブル --- */
.markdown-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.markdown-section table th {
  background: var(--theme-color);
  color: #fff;
  padding: 0.6rem 0.8rem;
  font-weight: 600;
  text-align: left;
}

.markdown-section table td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid #eee;
}

.markdown-section table tr:nth-child(even) {
  background: #f9f9f9;
}

.markdown-section table tr:hover {
  background: #eef6ff;
}

/* --- details/summary（ドリル解答） --- */
.markdown-section details {
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0.8rem 0;
  transition: all 0.2s;
}

.markdown-section details[open] {
  background: #f0fff4;
  border-color: var(--accent-green);
}

.markdown-section details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-green);
  outline: none;
  user-select: none;
}

.markdown-section details summary:hover {
  color: #219a52;
}

/* --- リスト --- */
.markdown-section ul, .markdown-section ol {
  padding-left: 1.5rem;
}

.markdown-section li {
  margin: 0.3rem 0;
  line-height: 1.7;
}

/* --- 画像 --- */
.markdown-section img {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin: 1rem 0;
}

/* --- ナビゲーション --- */
.markdown-section a {
  color: var(--theme-color);
  text-decoration: none;
  transition: color 0.2s;
}

.markdown-section a:hover {
  color: #2d6cb4;
  text-decoration: underline;
}

/* --- レスポンシブ --- */
@media (max-width: 768px) {
  .markdown-section {
    padding: 1rem;
  }

  .markdown-section h1 {
    font-size: 1.5rem;
  }

  .markdown-section h2 {
    font-size: 1.2rem;
  }

  .markdown-section pre {
    font-size: 0.8rem;
    padding: 0.8rem;
  }
}

/* --- 進捗バー --- */
.docsify-progress {
  z-index: 999;
}

/* --- 検索ボックス --- */
.search input {
  border-radius: 8px !important;
  border: 1px solid #ddd !important;
  padding: 0.5rem 1rem !important;
  font-size: 0.9rem !important;
}

.search input:focus {
  border-color: var(--theme-color) !important;
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2) !important;
}

/* --- コピーコードボタン --- */
.docsify-copy-code-button {
  font-size: 0.75rem !important;
}

/* --- 印刷用 --- */
@media print {
  .sidebar, .docsify-progress, .search {
    display: none !important;
  }

  .markdown-section {
    max-width: 100%;
    padding: 0;
  }

  .markdown-section details {
    display: block;
  }

  .markdown-section details[open] summary ~ * {
    display: block;
  }
}
