/* =============================================================
   topia Q&A 共通スタイル
   -------------------------------------------------------------
   全ページ (index.html / 各カテゴリ / 各記事) がこの1ファイルだけを
   読み込んでいます。デザインを変えるときはこのファイルだけ編集して
   ください。まずは下の :root の変数を変えるのが手軽です。

   HTML 構造 (全ページ共通):
     body.page.page-{home|category|article}
       header.site-header > a.site-title
       div.page-cover > img            (カバー画像があるページのみ)
       main.content
         nav.breadcrumb                (パンくず)
         h1.page-title > span.page-icon (絵文字アイコン)
         article.notion                (Notion の本文ブロック)
       footer.site-footer
   ============================================================= */

:root {
  /* --- 色 --- */
  --color-bg: #ffffff;
  --color-surface: #f7f7f8;
  --color-text: #37352f;
  --color-text-muted: #787774;
  --color-link: #2e7cf6;
  --color-border: #e9e9e7;
  --color-primary: #ff7a9e;         /* topia ブランドカラー (ヘッダー等) */
  --color-primary-text: #ffffff;
  --color-cover-bg: #01e3ad;        /* カバー (ロゴ帯) の背景色 */

  /* --- 文字 --- */
  --font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans",
                 "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  --font-size: 16px;
  --line-height: 1.8;

  /* --- レイアウト --- */
  --content-width: 760px;
  --content-padding: 16px;
  --radius: 8px;
  --cover-height: 200px;
}

/* ---------- リセット / ベース ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--font-size);
  line-height: var(--line-height);
  word-break: break-word;
  overflow-wrap: anywhere;
}
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
code {
  font-family: SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--color-surface);
  color: #eb5757;
  padding: 0.1em 0.4em;
  border-radius: 4px;
}
pre { background: var(--color-surface); padding: 16px; border-radius: var(--radius); overflow-x: auto; }
pre code { background: none; color: inherit; padding: 0; }
hr { border: 0; border-top: 1px solid var(--color-border); margin: 24px 0; }
hr.hr-thin { border-top-color: #999; margin: 20px 0; }

/* ---------- サイト共通パーツ ---------- */
.site-header {
  background: var(--color-primary);
  color: var(--color-primary-text);
  padding: 12px var(--content-padding);
}
.site-title {
  display: block;
  max-width: var(--content-width);
  margin: 0 auto;
  color: inherit;
  font-weight: 700;
  font-size: 18px;
}
.site-title:hover { text-decoration: none; opacity: 0.85; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.site-header .site-title { margin: 0; flex: 1 1 auto; }
.site-nav a {
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 999px;
  white-space: nowrap;
}
.site-nav a:hover { text-decoration: none; background: rgba(255,255,255,.15); }
@media (min-width: 800px) {
  .site-header { max-width: var(--content-width); margin: 0 auto; }
  .site-header { max-width: none; }
  .site-header > * { }
}

/* ---------- トップの検索誘導セクション ---------- */
.search-hero {
  margin: 0 0 28px;
  padding: 24px 20px;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 2px solid var(--color-primary);
  text-align: center;
}
.notion .search-hero-title { font-size: 22px; margin: 0 0 6px; padding: 0; }
.search-hero-lead { color: var(--color-text-muted); margin: 0 0 14px; font-size: 14px; }
.search-hero-form { display: flex; gap: 8px; max-width: 560px; margin: 0 auto 12px; }
.search-hero-input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  padding: 12px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}
.search-hero-input:focus { outline: none; border-color: var(--color-primary); }
.search-hero-button {
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--color-primary-text);
  cursor: pointer;
}
.search-hero-button:hover { opacity: .9; }
.search-hero-link { font-size: 14px; font-weight: 700; }

/* ---------- 記事検索ページ (qa.html) ---------- */
.qa-lead { color: var(--color-text-muted); margin: 0 0 12px; }
.qa-form { display: flex; gap: 8px; margin-bottom: 16px; }
.qa-input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  padding: 12px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}
.qa-input:focus { outline: none; border-color: var(--color-primary); }
.qa-button {
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--color-primary-text);
  cursor: pointer;
}
.qa-button:hover { opacity: .9; }
.qa-suggest { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 24px; }
.qa-suggest-label { width: 100%; font-size: 13px; color: var(--color-text-muted); }
.qa-chip {
  font: inherit;
  font-size: 14px;
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}
.qa-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.qa-count { font-size: 13px; color: var(--color-text-muted); margin: 0 0 8px; }
.qa-empty { padding: 24px 0; color: var(--color-text-muted); }
.qa-list { list-style: none; margin: 0; padding: 0; }
.qa-item { margin: 0 0 10px; }
.qa-link {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: inherit;
  transition: box-shadow .15s;
}
.qa-link:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.08); border-color: var(--color-primary); }
.qa-cat { display: inline-block; font-size: 12px; color: var(--color-primary); font-weight: 700; margin-bottom: 2px; }
/* ヘルプセンター階層外の公開ドキュメント (別サイトへ飛ぶ結果) */
.qa-item-external .qa-cat { color: var(--color-text-muted); }
.qa-item-external .qa-link { border-style: dashed; }
.qa-item-external .qa-title::after { content: " ↗"; color: var(--color-text-muted); font-weight: 400; }
.qa-title { display: block; font-size: 17px; font-weight: 700; }
.qa-heading { display: block; font-size: 14px; color: var(--color-text); margin-top: 2px; }
.qa-heading::before { content: "› "; color: var(--color-text-muted); }
.qa-snippet { display: block; font-size: 13px; color: var(--color-text-muted); margin-top: 6px; line-height: 1.6; }
.qa-link mark { background: #fff3b0; color: inherit; padding: 0 1px; border-radius: 2px; }

/* カバー (トップ・カテゴリページ): topia ロゴ + 「Q&A」のテキスト。背景色は --color-cover-bg */
.page-cover {
  width: 100%;
  height: var(--cover-height);
  overflow: hidden;
  background: var(--color-cover-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 var(--content-padding);
}
.page-cover .cover-logo { height: 44px; width: auto; }
.page-cover .cover-text {
  color: #fff;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}
@media (max-width: 480px) {
  .page-cover .cover-logo { height: 34px; }
  .page-cover .cover-text { font-size: 30px; }
}

.content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 24px var(--content-padding) 48px;
}

.breadcrumb { font-size: 13px; color: var(--color-text-muted); margin-bottom: 16px; }
.breadcrumb a { color: inherit; }
.breadcrumb .sep { margin: 0 6px; }

.page-title { font-size: 28px; line-height: 1.3; margin: 0 0 24px; font-weight: 700; }
.page-title .page-icon { margin-right: 8px; }
.page-home .page-title { font-size: 32px; }

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 24px var(--content-padding);
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ---------- Notion 本文ブロック ---------- */
.notion > * { margin-top: 0; }
.notion p { margin: 0 0 4px; min-height: 1em; }
.notion p.blank { margin: 0; height: 1em; }
.notion h2 { font-size: 22px; margin: 32px 0 8px; line-height: 1.4; }
.notion h3 { font-size: 19px; margin: 24px 0 6px; line-height: 1.4; }
.notion h4 { font-size: 16px; margin: 18px 0 4px; line-height: 1.4; }
.notion h5 { font-size: 15px; margin: 14px 0 4px; line-height: 1.4; }
.notion h2, .notion h3, .notion h4, .notion h5 { font-weight: 700; padding: 2px 4px; border-radius: 4px; }

.notion ul, .notion ol { margin: 0 0 4px; padding-left: 1.6em; }
.notion li { margin: 2px 0; }
.notion li > ul, .notion li > ol { margin-top: 2px; }
.notion li > p { margin: 2px 0; }

/* 画像 */
.notion figure.image { margin: 12px 0; }
.notion figure.image img { width: var(--img-width, auto); max-width: 100%; margin: 0 auto; border-radius: 4px; }  /* --img-width は Notion 上の表示幅 */
.notion figure.image.align-left img { margin-left: 0; }
.notion figure.image.align-right img { margin-right: 0; }
.notion figcaption { font-size: 13px; color: var(--color-text-muted); text-align: center; margin-top: 6px; }

/* コールアウト */
.notion .callout {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  margin: 8px 0;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}
.notion .callout-icon { flex: 0 0 auto; font-size: 20px; line-height: 1.4; }
.notion .callout-body { flex: 1 1 auto; min-width: 0; }
.notion .callout-body > p:last-child, .notion .callout-body > ul:last-child { margin-bottom: 0; }

/* トグル (折りたたみ) */
.notion details.toggle { margin: 8px 0; }
.notion details.toggle > summary { cursor: pointer; list-style: none; display: flex; align-items: center; }
.notion details.toggle > summary::-webkit-details-marker { display: none; }
.notion details.toggle > summary::before {
  content: "▶";
  font-size: 11px;
  margin-right: 8px;
  color: var(--color-text-muted);
  transition: transform .15s;
}
.notion details.toggle[open] > summary::before { transform: rotate(90deg); }
.notion details.toggle > summary > h2, .notion details.toggle > summary > h3, .notion details.toggle > summary > h4 { margin: 0; }
.notion .toggle-body { padding-left: 20px; margin-top: 6px; }

/* テーブル */
.notion .table-wrap { overflow-x: auto; margin: 12px 0; }
.notion table { border-collapse: collapse; width: 100%; font-size: 14px; }
.notion th, .notion td { border: 1px solid var(--color-border); padding: 8px 10px; text-align: left; vertical-align: top; }
.notion th { background: var(--color-surface); font-weight: 700; }

/* 2カラム等 */
.notion .columns { display: flex; gap: 24px; margin: 8px 0; }
.notion .column { min-width: 0; }
@media (max-width: 640px) {
  .notion .columns { flex-direction: column; gap: 8px; }
}

/* ブックマーク (リンクカード) */
.notion a.bookmark {
  display: block;
  margin: 8px 0;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: inherit;
}
.notion a.bookmark:hover { text-decoration: none; background: var(--color-surface); }
.notion .bookmark-title { display: block; font-weight: 700; }
.notion .bookmark-desc { display: block; font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }
.notion .bookmark-url { display: block; font-size: 12px; color: var(--color-text-muted); margin-top: 4px; word-break: break-all; }

/* 目次 */
.notion .toc { margin: 8px 0 16px; }
.notion .toc ul { list-style: none; padding: 0; margin: 0; }
.notion .toc li { margin: 2px 0; }
.notion .toc .toc-l2 { padding-left: 1.2em; }
.notion .toc .toc-l3 { padding-left: 2.4em; }
.notion .toc .toc-l4 { padding-left: 3.6em; }

/* 引用など */
.notion blockquote { margin: 8px 0; padding: 4px 16px; border-left: 3px solid var(--color-text); }

/* ---------- トップページのカテゴリ一覧 (ギャラリー) ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 16px 0 24px;
}
.gallery .card {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-bg);
  color: inherit;
  transition: box-shadow .15s, transform .15s;
}
.gallery .card:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-2px); }
.gallery .card-cover { aspect-ratio: 16 / 9; background: var(--color-surface); }
.gallery .card-cover img { width: 100%; height: 100%; object-fit: cover; }
.gallery .card-title { padding: 10px 12px; font-weight: 700; font-size: 15px; }
/* カード画像の中にタイトルが入っているので文字タイトルは隠す (Notion と同じ) */
.gallery .card-title { display: none; }

/* ---------- Notion の色 (文字色 / 背景色) ---------- */
.color-gray   { color: #787774; }
.color-brown  { color: #9f6b53; }
.color-orange { color: #d9730d; }
.color-yellow { color: #cb912f; }
.color-green  { color: #448361; }
.color-blue   { color: #337ea9; }
.color-purple { color: #9065b0; }
.color-pink   { color: #c14c8a; }
.color-red    { color: #d44c47; }
.color-teal   { color: #448361; }

.color-gray_background    { background: #f1f1ef; }
.color-brown_background   { background: #f4eeee; }
.color-orange_background  { background: #fbecdd; }
.color-yellow_background  { background: #fbf3db; }
.color-green_background   { background: #edf3ec; }
.color-blue_background    { background: #e7f3f8; }
.color-purple_background  { background: #f6f3f9; }
.color-pink_background    { background: #faf1f5; }
.color-red_background     { background: #fdebec; }
.color-teal_background    { background: #edf3ec; }
.color-default_background { background: transparent; }

/* 背景色付き見出しは帯のように見せる */
.notion h2[class*="_background"], .notion h3[class*="_background"], .notion h4[class*="_background"] {
  padding: 6px 12px;
}
