/* ========================================
   おやこラボ — セージグリーン配色の完全自作CSS
   ======================================== */

:root {
  --accent: #6b9e8a;
  --accent-light: #eef5f2;
  --accent-dark: #4d7e6b;
  --text: #2c3e3a;
  --text-muted: #6b7b78;
  --bg: #fafaf8;
  --bg-card: #ffffff;
  --border: #e8eeec;
  --font: 'Noto Sans JP', sans-serif;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(44, 62, 58, 0.08);
  --shadow-hover: 0 4px 16px rgba(44, 62, 58, 0.14);
}

/* ========================================
   リセット / ベース
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--text);
  background-color: #f5f4ef;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%236b9e8a' stroke-opacity='0.06'%3E%3Ccircle cx='20' cy='20' r='16'/%3E%3Ccircle cx='20' cy='20' r='10'/%3E%3Ccircle cx='20' cy='20' r='4'/%3E%3C/g%3E%3C/svg%3E");
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent-dark);
  text-decoration: none;
}

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

/* ========================================
   レイアウト
   ======================================== */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ========================================
   2カラムレイアウト（メイン＋サイドバー）
   ======================================== */

.layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
  min-height: calc(100vh - 260px);
}

/* サイドバーなし（記事・固定ページ）は中央寄せの読みやすい幅に */
.layout:not(.has-sidebar) .main-col {
  max-width: 800px;
  margin: 0 auto;
}

/* サイドバーあり（トップページ等）は2カラムグリッド */
.layout.has-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2.5rem;
  align-items: start;
}

/* ========================================
   ヘッダー
   ======================================== */

.site-header {
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.site-header .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding-top: 1.5rem;
  padding-bottom: 1.1rem;
}

.site-tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  letter-spacing: 0.02em;
}

.site-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-dark);
  text-decoration: none;
  letter-spacing: 0.1em;
  line-height: 1.2;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ナビゲーションバー（中央寄せ横並び） */
.site-nav {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 2px solid var(--accent);
}

.site-nav .container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.site-nav a {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  padding: 0.85rem 1.25rem;
  border-bottom: 3px solid transparent;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.site-nav a:hover {
  color: var(--accent-dark);
  background: var(--accent-light);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* ========================================
   セクションタイトル
   ======================================== */

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding: 0.5rem 0 0.5rem 0.875rem;
  border-left: 5px solid var(--accent);
  border-bottom: 1px solid var(--border);
}

/* ========================================
   サイドバー（ウィジェット）
   ======================================== */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.widget-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  background: #eceae3;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}

.widget-body {
  padding: 1rem;
}

.widget-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.widget-list li {
  border-bottom: 1px dashed var(--border);
  padding: 0.6rem 0;
}

.widget-list li:first-child {
  padding-top: 0;
}

.widget-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.widget-list a {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  line-height: 1.5;
}

.widget-list a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.widget-date {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* カウント付きリスト（カテゴリ・アーカイブ） */
.widget-list-count li {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.widget-list-count a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.widget-count {
  flex-shrink: 0;
  margin-left: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--accent-light);
  border-radius: 100px;
  padding: 0.05rem 0.6rem;
  min-width: 1.8rem;
  text-align: center;
}

.widget-archive-label {
  font-size: 0.9rem;
  color: var(--text);
}

/* 検索ボックス */
.search-form {
  margin: 0;
}

.search-input {
  width: 100%;
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.55rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.search-results {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.search-results:empty {
  margin: 0;
}

.search-results li {
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border);
}

.search-results li:last-child {
  border-bottom: none;
}

.search-results a {
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
}

.search-results a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.search-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}

/* ========================================
   記事カード
   ======================================== */

.post-grid {
  display: grid;
  gap: 1.25rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.post-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.post-card-date {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.post-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.post-card-title a {
  color: var(--text);
  text-decoration: none;
}

.post-card-title a:hover {
  color: var(--accent-dark);
  text-decoration: none;
}

.post-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* カテゴリバッジ */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15rem 0.6rem;
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: 100px;
  text-decoration: none;
  white-space: nowrap;
}

.badge:hover {
  background: var(--accent);
  color: white;
  text-decoration: none;
}

/* もっと見るボタン */
.more-link {
  text-align: center;
  margin-top: 1.5rem;
}

.btn-more {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: var(--accent);
  color: white;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-more:hover {
  background: var(--accent-dark);
  color: white;
  text-decoration: none;
}

/* ========================================
   カテゴリセクション（トップページ）
   ======================================== */

.category-section {
  margin-top: 2.5rem;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.category-list a {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s;
}

.category-list a:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
  text-decoration: none;
}

/* ========================================
   記事一覧ページ
   ======================================== */

.posts-page h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

/* ========================================
   記事ページ
   ======================================== */

.post-header {
  margin-bottom: 2rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.post-meta time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.post-title {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.post-description {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
  background: var(--accent-light);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: 3px solid var(--accent);
}

/* ========================================
   目次（TOC）
   ======================================== */

.toc {
  background: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.toc-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--accent-dark);
}

.toc ol, .toc ul {
  padding-left: 1.25rem;
}

.toc li {
  margin: 0.3rem 0;
}

.toc a {
  color: var(--text);
  text-decoration: none;
}

.toc a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

/* ========================================
   記事本文スタイル
   ======================================== */

.post-body {
  line-height: 1.9;
  font-size: 1rem;
}

.post-body h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  padding: 0.5rem 0 0.5rem 0.875rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  line-height: 1.5;
}

.post-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--accent);
  line-height: 1.5;
}

.post-body h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: var(--accent-dark);
}

.post-body p {
  margin: 0 0 1.25rem;
}

.post-body ul, .post-body ol {
  margin: 0 0 1.25rem 1.5rem;
}

.post-body li {
  margin: 0.35rem 0;
}

.post-body blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.post-body strong {
  font-weight: 700;
  color: var(--text);
}

.post-body code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.875em;
  background: var(--accent-light);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--accent-dark);
}

.post-body pre {
  background: #2c3e3a;
  color: #eef5f2;
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.875rem;
}

/* テーブル */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.post-body th {
  background: var(--accent-light);
  padding: 0.6rem 0.875rem;
  text-align: left;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--accent-dark);
}

.post-body td {
  padding: 0.6rem 0.875rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

.post-body tr:nth-child(even) td {
  background: var(--bg);
}

/* ========================================
   シェアボタン
   ======================================== */

.custom-share-buttons {
  display: flex;
  gap: 0.75rem;
  margin: 2rem 0 1.5rem;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.1s;
}

.share-btn:hover {
  opacity: 0.85;
  text-decoration: none;
}

.share-btn:active {
  transform: scale(0.97);
}

.share-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.share-hatena {
  background: #00a4de;
  color: white;
}

.share-line {
  background: #06c755;
  color: white;
}

.share-copy {
  background: var(--accent-light);
  color: var(--accent-dark);
  border: 1px solid var(--border);
}

.copy-toast {
  display: none;
  font-size: 0.82rem;
  color: var(--accent-dark);
  background: var(--accent-light);
  border: 1px solid var(--border);
  padding: 0.35rem 0.875rem;
  border-radius: 100px;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

.copy-toast.visible {
  display: inline-block;
}

/* ========================================
   CTAブロック
   ======================================== */

.app-cta-block {
  background: linear-gradient(135deg, var(--accent-light) 0%, #ffffff 100%);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}

.app-cta-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-dark);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.app-cta-inner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.app-cta-text {
  flex: 1;
}

.app-cta-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.app-cta-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  line-height: 1.6;
}

.app-cta-button {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  background: var(--accent-dark);
  color: white;
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s;
}

.app-cta-button:hover {
  background: var(--accent);
  color: white;
  text-decoration: none;
}

/* ========================================
   著者カード
   ======================================== */

.author-card {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 2.5rem;
}

.author-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-light);
  flex-shrink: 0;
}

.author-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.author-bio {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ========================================
   固定ページ
   ======================================== */

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

/* ========================================
   カテゴリページ
   ======================================== */

.post-count {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ========================================
   フッター
   ======================================== */

.site-footer {
  background: #4a4a47;
  color: #d6d4cd;
  padding: 2.5rem 0;
  margin-top: 3rem;
  font-size: 0.875rem;
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
}

.site-footer p {
  color: #d6d4cd;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav a {
  color: #d6d4cd;
  text-decoration: none;
  font-size: 0.82rem;
}

.footer-nav a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ========================================
   ホットリロードインジケーター（serve.py 用）
   ======================================== */

.dev-indicator {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: #2c3e3a;
  color: #6b9e8a;
  font-size: 0.75rem;
  font-family: monospace;
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  opacity: 0.8;
  z-index: 9999;
  pointer-events: none;
}

/* ========================================
   レスポンシブ（モバイル対応）
   ======================================== */

/* サイドバーありレイアウトはタブレット幅で1カラムに */
@media (max-width: 900px) {
  .layout.has-sidebar {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sidebar {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .site-header .container {
    padding-top: 1.1rem;
    padding-bottom: 0.85rem;
  }

  .site-title {
    font-size: 1.6rem;
  }

  .site-tagline {
    font-size: 0.72rem;
    text-align: center;
  }

  /* モバイルでもナビは横一列を維持（折り返さない） */
  .site-nav .container {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .site-nav a {
    padding: 0.7rem 0.7rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .layout {
    padding-top: 1.75rem;
  }

  .post-title {
    font-size: 1.35rem;
  }

  .author-card {
    flex-direction: column;
  }

  .author-avatar {
    width: 60px;
    height: 60px;
  }

  .custom-share-buttons {
    gap: 0.5rem;
  }

  .share-btn {
    padding: 0.45rem 0.875rem;
    font-size: 0.82rem;
  }
}
