/* ================================================================
   AI x Flutter Cookbook — flutter.aiseed.dev
   手書きのスタイルシート。フレームワーク不使用。
   配色: 温かみのある紙 × 種(seed)の緑
   ================================================================ */

:root {
  --bg: #fbfaf6;          /* 温かい紙の色 */
  --bg-raised: #f3f1e9;
  --text: #33322e;
  --text-soft: #6d6a61;
  --accent: #2f7d5c;      /* 種の緑 */
  --accent-soft: #e7f0ea;
  --border: #e2dfd4;
  --code-bg: #f0efe8;
  --max-width: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191b18;
    --bg-raised: #22251f;
    --text: #d8d6cd;
    --text-soft: #97948a;
    --accent: #6fbd93;
    --accent-soft: #24352b;
    --border: #35382f;
    --code-bg: #22251f;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
               "Yu Gothic Medium", YuGothic, sans-serif;
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- ヘッダー ---------------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.header-links {
  display: flex;
  gap: 1rem;
  font-size: 0.88rem;
}

.header-links a {
  color: var(--text-soft);
  text-decoration: none;
}
.header-links a:hover { color: var(--accent); }

/* ---------------- レイアウト ---------------- */
.layout {
  display: flex;
  max-width: 76rem;
  margin: 0 auto;
  align-items: flex-start;
}

/* ---------------- サイドバー ---------------- */
.sidebar {
  width: 17.5rem;
  flex-shrink: 0;
  position: sticky;
  top: 3.4rem;
  max-height: calc(100vh - 3.4rem);
  overflow-y: auto;
  padding: 1.2rem 0.8rem 2rem 1.2rem;
  font-size: 0.86rem;
  line-height: 1.6;
}

.sidebar .nav-home {
  display: block;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 0.8rem;
}

.sidebar details { margin-bottom: 0.25rem; }

.sidebar summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  color: var(--text);
  list-style: none;
}
.sidebar summary::before { content: "▸ "; color: var(--accent); }
.sidebar details[open] summary::before { content: "▾ "; }
.sidebar summary:hover { background: var(--accent-soft); }

.sidebar ul {
  list-style: none;
  margin: 0.1rem 0 0.5rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--border);
}

.sidebar li a {
  display: block;
  color: var(--text-soft);
  text-decoration: none;
  padding: 0.14rem 0.35rem;
  border-radius: 5px;
}
.sidebar li a:hover { color: var(--accent); background: var(--accent-soft); }
.sidebar li.current a {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
}

/* ---------------- 本文 ---------------- */
.content {
  flex: 1;
  min-width: 0;
  max-width: var(--max-width);
  padding: 2rem 1.4rem 4rem;
}

.content h1 {
  font-size: 1.7rem;
  line-height: 1.5;
  border-bottom: 3px solid var(--accent);
  padding-bottom: 0.4rem;
  margin: 0.5rem 0 1.4rem;
}

.content h2 {
  font-size: 1.3rem;
  margin-top: 2.6rem;
  padding-left: 0.6rem;
  border-left: 4px solid var(--accent);
}

.content h3 { font-size: 1.1rem; margin-top: 2rem; }

.content a { color: var(--accent); }

.content img { max-width: 100%; }

/* 引用（プロンプト例などのコールアウト） */
.content blockquote {
  margin: 1.2rem 0;
  padding: 0.7rem 1.1rem;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.content blockquote p { margin: 0.4rem 0; }

/* コード */
.content code {
  font-family: "SF Mono", Menlo, Consolas, "Noto Sans Mono", monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}

.content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  line-height: 1.6;
}
.content pre code { background: none; padding: 0; font-size: 0.84rem; }

/* 表 */
.content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.2rem 0;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}
.content th, .content td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.8rem;
  text-align: left;
}
.content th { background: var(--bg-raised); }

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.4rem 0;
}

/* ---------------- フッター ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.4rem 1.2rem 2.2rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-soft);
}
.site-footer a { color: var(--accent); }
.site-footer p { margin: 0.3rem 0; }

/* ---------------- モバイル ---------------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    max-height: none;
    border-bottom: 1px solid var(--border);
    padding: 0.8rem 1.2rem;
  }
  .sidebar details { display: inline-block; margin-right: 0.6rem; }
  .sidebar ul { border-left: none; }
  .content { padding: 1.4rem 1.2rem 3rem; }
}
