/* ===== AoMocha Blog — public pages ===== */

/* ---------- テーマ変数（共通パターンに統一） ---------- */
:root {
  --bg: #f4f4f6;
  --bg2: #ffffff;
  --text: #1a1a2e;
  --text-muted: #666;
  --border: rgba(0,0,0,0.1);
  --card-bg: #ffffff;
  --card-shadow: 0 2px 16px rgba(0,0,0,0.08);
  --nav-bg: #ffffff;
  --nav-border: rgba(0,0,0,0.08);
  --code-bg: #f0f0f2;
  --link: #5b6af0;
  --btn: #5b6af0;
  --placeholder-bg: #e0e0e4;
}

[data-theme="dark"] {
  --bg: #111318;
  --bg2: #1a1d26;
  --text: #e8e8f0;
  --text-muted: #888;
  --border: rgba(255,255,255,0.08);
  --card-bg: #1e2130;
  --card-shadow: 0 2px 16px rgba(0,0,0,0.4);
  --nav-bg: #15171f;
  --nav-border: rgba(255,255,255,0.07);
  --code-bg: #252836;
  --link: #7c8fff;
  --btn: #5b6af0;
  --placeholder-bg: #252836;
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg: #111318;
    --bg2: #1a1d26;
    --text: #e8e8f0;
    --text-muted: #888;
    --border: rgba(255,255,255,0.08);
    --card-bg: #1e2130;
    --card-shadow: 0 2px 16px rgba(0,0,0,0.4);
    --nav-bg: #15171f;
    --nav-border: rgba(255,255,255,0.07);
    --code-bg: #252836;
    --link: #7c8fff;
    --btn: #5b6af0;
    --placeholder-bg: #252836;
  }
}

/* blog固有の名前は残しつつ、実体は共通変数にマッピング
   （記事カード等のCSSを大量に書き換えずに済ませるため） */
:root, [data-theme="dark"], [data-theme="light"] {
  --blog-bg: var(--bg);
  --blog-surface: var(--card-bg);
  --blog-surface-alt: var(--code-bg);
  --blog-border: var(--border);
  --blog-text: var(--text);
  --blog-text-dim: var(--text-muted);
  --blog-accent: var(--link);
  --blog-accent-dim: color-mix(in srgb, var(--link) 15%, transparent);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  line-height: 1.75;
  transition: background 0.2s, color 0.2s;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--link); }

/* ---------- Topbar（共通パターンに統一。旧 .site-header は撤去） ---------- */
.topbar {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
  opacity: 0.6;
  flex-shrink: 0;
}
.hamburger:hover { opacity: 1; }
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.blog-site-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

/* ページ見出し（記事一覧トップ等、以前 .site-header 内にあったタイトル/タグライン用） */
.page-header {
  padding: 2rem 1.5rem 0.5rem;
  text-align: center;
}
.site-title { font-size: 1.6rem; font-weight: 700; margin: 0; letter-spacing: 0.02em; }
.site-tagline { color: var(--text-muted); font-size: 0.85rem; margin: 0.4rem 0 0; }

/* ---------- Layout ---------- */
.blog-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2.5rem;
  align-items: start;
}
@media (max-width: 860px) {
  .blog-layout { grid-template-columns: 1fr; }
}

.list-page-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* ---------- Article cards (index / tag / archive / search) ---------- */
.article-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--card-shadow);
}
.article-card-date { color: var(--text-muted); font-size: 0.8rem; margin: 0 0 0.4rem; }
.article-card-title-link { display: block; }
.article-card-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 1rem; line-height: 1.4; }
.article-card-cover { display: block; border-radius: 10px; overflow: hidden; margin-bottom: 1rem; background: var(--code-bg); }
.article-card-cover img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }
.article-card-cover-placeholder {
  aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.9rem;
}
.article-card-excerpt { color: var(--text-muted); font-size: 0.92rem; margin: 0 0 0.8rem; }
.article-card-readmore { font-size: 0.85rem; color: var(--link); font-weight: 600; }

.empty-state { color: var(--text-muted); padding: 2rem 0; text-align: center; }
.empty-state-small { color: var(--text-muted); font-size: 0.82rem; }

.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; font-size: 0.9rem; }
.pagination-current { color: var(--text-muted); }

/* ---------- Full article page ---------- */
.article-full-date { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 0.5rem; }
.article-full-title { font-size: 1.8rem; font-weight: 800; line-height: 1.4; margin: 0 0 1rem; }
.article-full-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.article-full-cover { border-radius: 14px; overflow: hidden; margin-bottom: 2rem; }
.article-full-cover img { width: 100%; display: block; }

.article-full-body { font-size: 1rem; }
.article-block-heading { margin: 2rem 0 1rem; font-weight: 700; }
.article-block-paragraph { margin: 0 0 1.2rem; color: var(--text); }
.article-block-list { margin: 0 0 1.2rem; padding-left: 1.4rem; }
.article-block-list li { margin-bottom: 0.4rem; }
.article-block-image { margin: 1.5rem 0; }
.article-block-image img { width: 100%; border-radius: 10px; display: block; }
.article-block-image figcaption { color: var(--text-muted); font-size: 0.82rem; text-align: center; margin-top: 0.5rem; }
.article-block-quote {
  margin: 1.5rem 0; padding: 1rem 1.4rem; border-left: 3px solid var(--link);
  background: var(--code-bg); border-radius: 0 8px 8px 0; color: var(--text-muted);
}
.article-block-quote cite { display: block; margin-top: 0.5rem; font-size: 0.8rem; }
.article-block-delimiter { text-align: center; color: var(--text-muted); margin: 2rem 0; letter-spacing: 0.3em; }

.article-block-link-card {
  display: flex; gap: 1rem; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; margin: 1.5rem 0; background: var(--card-bg);
}
.article-block-link-card:hover { border-color: var(--link); }
.link-card-image { width: 120px; height: 90px; object-fit: cover; flex-shrink: 0; }
.link-card-body { padding: 0.8rem 1rem 0.8rem 0; display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.link-card-title { font-weight: 600; font-size: 0.9rem; }
.link-card-desc { color: var(--text-muted); font-size: 0.8rem; }
.link-card-url { color: var(--text-muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Speech bubble (custom block) ---------- */
.speech-bubble {
  display: flex; align-items: flex-start; gap: 0.8rem; margin: 1.5rem 0; max-width: 80%;
}
.speech-bubble-left { flex-direction: row; margin-right: auto; }
.speech-bubble-right { flex-direction: row-reverse; margin-left: auto; }
.speech-bubble-icon {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--link) 15%, transparent); border: 1px solid var(--border);
}
.speech-bubble-text {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 0.7rem 1rem; font-size: 0.92rem; position: relative;
}

/* ---------- Sidebar ---------- */
.blog-sidebar { display: flex; flex-direction: column; gap: 1.8rem; }
.sidebar-block {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.2rem; box-shadow: var(--card-shadow);
}
.sidebar-heading { font-size: 0.8rem; font-weight: 700; margin: 0 0 1rem; color: var(--text-muted); letter-spacing: 0.03em; }

.search-form { display: flex; gap: 0.5rem; }
.search-form input {
  flex: 1; background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.5rem 0.7rem; color: var(--text); font-size: 0.85rem;
}
.search-form button {
  background: var(--btn); border: none; border-radius: 8px; width: 36px;
  display: flex; align-items: center; justify-content: center; color: #fff; cursor: pointer;
}

.latest-article-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.latest-article-item.latest-hidden { display: none; }
.latest-article-item a { display: flex; align-items: center; gap: 0.6rem; }
.latest-article-item img, .latest-article-thumb-placeholder {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  background: var(--code-bg); display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.8rem;
}
.latest-article-title { font-size: 0.85rem; line-height: 1.4; }
.sidebar-expand-btn {
  width: 100%; margin-top: 0.8rem; background: var(--code-bg); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 8px; padding: 0.45rem; font-size: 0.8rem; cursor: pointer;
}
.sidebar-more-link { display: block; margin-top: 0.8rem; font-size: 0.8rem; color: var(--link); }

.archive-tree { list-style: none; margin: 0; padding: 0; }
.archive-year { margin-bottom: 0.3rem; }
.archive-year-toggle {
  width: 100%; text-align: left; background: none; border: none; color: var(--text);
  font-size: 0.85rem; font-weight: 600; padding: 0.35rem 0; cursor: pointer;
}
.archive-month-list {
  list-style: none; margin: 0 0 0 0.8rem; padding: 0; max-height: 0; overflow: hidden;
}
.archive-year.open .archive-month-list { max-height: 500px; }
.archive-month-list li { padding: 0.25rem 0; font-size: 0.8rem; color: var(--text-muted); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-pill {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.3rem 0.7rem; font-size: 0.78rem; color: var(--text-muted);
}
.tag-pill:hover { color: var(--link); border-color: var(--link); }
.tag-count { opacity: 0.6; margin-left: 0.2rem; }

/* ---------- Footer ---------- */
.site-footer { text-align: center; padding: 2rem; color: var(--text-muted); font-size: 0.8rem; }
