/* Notion Design System - ai-companion blog */

/* ========================================
   CSS Variables & Reset
   ======================================== */
:root {
  /* Colors - Notion Palette */
  --bg-primary: #f6f5f4;
  --bg-surface: #ffffff;
  --text-primary: rgba(0, 0, 0, 0.95);
  --text-secondary: rgba(0, 0, 0, 0.65);
  --text-tertiary: rgba(0, 0, 0, 0.45);
  --accent-blue: #0075de;
  --accent-blue-hover: #005fb8;
  --border-whisper: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(0, 0, 0, 0.2);
  
  /* Typography */
  --font-sans: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-size-base: 16px;
  --line-height-base: 1.6;
  
  /* Spacing - 8px Base Unit */
  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 24px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;
  --spacing-2xl: 64px;
  
  /* Layout */
  --max-width: 1200px;
  --sidebar-width: 300px;
  --header-height: 64px;
  
  /* Effects */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --transition: all 0.2s ease;
}

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

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

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

/* ========================================
   Header & Navigation
   ======================================== */
body > header {
  background: linear-gradient(135deg, #1a365d 0%, #2b77e6 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

/* 記事内ヘッダーにはサイト共通ヘッダーの固定表示を適用しない */
.article-header,
.post-header {
  position: static;
  top: auto;
  z-index: auto;
}

header .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
}

.nav-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.nav-brand a {
  color: white;
  text-decoration: none;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.nav-menu li a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-menu li a:hover {
  background-color: rgba(255, 255, 255, 0.2);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 4px;
}

.nav-toggle span {
  width: 25px;
  height: 3px;
  background: white;
  transition: var(--transition);
}

/* ========================================
   Main Layout
   ======================================== */
main {
  flex: 1;
  width: 100%;
}

.blog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--spacing-lg);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-sm);
}

.blog-main {
  min-width: 0;
}

.blog-sidebar {
  min-width: 0;
}

/* ========================================
   Blog Page Header
   ======================================== */
.blog-page-header {
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-whisper);
}

.blog-page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
  color: var(--text-primary);
}

.blog-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* ========================================
   Blog Grid & Cards
   ======================================== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

.blog-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-whisper);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.blog-card a {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-card a:hover {
  text-decoration: none;
  color: inherit;
}

.card-thumb {
  position: relative;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: var(--bg-primary);
  overflow: hidden;
}

.card-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.blog-card:hover .card-thumb img {
  transform: scale(1.05);
}

.card-body {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-body time {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-bottom: var(--spacing-xs);
}

.card-body h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  color: var(--text-primary);
  line-height: 1.4;
}

.card-body p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Empty State */
.blog-card.empty-state {
  grid-column: 1 / -1;
  padding: var(--spacing-2xl);
  text-align: center;
  background: var(--bg-surface);
  border: 1px dashed var(--border-whisper);
  border-radius: var(--radius-md);
}

.blog-card.empty-state h3 {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.blog-card.empty-state p {
  color: var(--text-tertiary);
}

/* ========================================
   Blog Article
   ======================================== */
.blog-article {
  background: var(--bg-surface);
  border: 1px solid var(--border-whisper);
  border-radius: var(--radius-md);
  padding: var(--spacing-xl);
}

.blog-article h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  line-height: 1.3;
}

.blog-article-meta {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-whisper);
}

.blog-article-meta time {
  font-size: 0.9rem;
  color: var(--text-tertiary);
}

.blog-article-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.blog-article-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: var(--spacing-xl) 0 var(--spacing-md);
}

.blog-article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: var(--spacing-lg) 0 var(--spacing-sm);
}

.blog-article-content p {
  margin-bottom: var(--spacing-md);
}

.blog-article-content img {
  margin: var(--spacing-md) 0;
  border-radius: var(--radius-md);
}

/* ========================================
   Sidebar
   ======================================== */
.blog-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.sidebar-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border-whisper);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
}

.sidebar-widget h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--border-whisper);
}

.sidebar-ad {
  padding: 0;
  overflow: hidden;
}

.sidebar-ad.amazon-ad {
  background: var(--bg-surface);
  border: 1px dashed var(--border-hover);
  color: var(--text-tertiary);
  font-size: 0.875rem;
  text-align: center;
}

.sidebar-ad.amazon-ad div {
  padding: 2rem 1rem;
}

.sidebar-ad [w3-include-html] {
  min-height: 120px;
}

.sidebar-ad-placeholder {
  padding: var(--spacing-lg);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* Categories */
.category-list {
  list-style: none;
}

.category-list li {
  margin-bottom: var(--spacing-xs);
}

.category-list a {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.category-list a:hover {
  background: var(--bg-primary);
  text-decoration: none;
}

.category-count {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-whisper);
  padding: var(--spacing-xl) 0;
  margin-top: var(--spacing-2xl);
}

.site-footer .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.footer-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
}

.footer-section p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: var(--spacing-xs);
}

.footer-section a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer-section a:hover {
  color: var(--accent-blue);
  text-decoration: none;
}

.footer-bottom {
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-whisper);
  text-align: center;
}

.footer-bottom p {
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
  .blog-layout {
    grid-template-columns: 1fr;
  }
  
  .blog-sidebar {
    order: -1;
  }
  
  .nav-menu {
    display: none;
  }
  
  .nav-toggle {
    display: flex;
  }
  
  .blog-page-header h1 {
    font-size: 1.75rem;
  }
  
  .blog-grid {
    grid-template-columns: 1fr;
  }
  
  .blog-article {
    padding: var(--spacing-md);
  }
  
  .blog-article h1 {
    font-size: 1.5rem;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  :root {
    --font-size-base: 14px;
  }
  
  .navbar {
    flex-wrap: wrap;
  }
  
  .nav-brand h1 {
    font-size: 1rem;
  }
}

/* ========================================
   Utility Classes
   ======================================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent-blue);
  color: white;
  padding: var(--spacing-xs) var(--spacing-sm);
  z-index: 9999;
  transition: var(--transition);
}

.skip-link:focus {
  top: 0;
}

/* ========================================
   Blog Index Page (一覧ページ専用)
   本体サイト styles.css のデザイントーンに合わせる。
   記事ページ(20YYMMDD-NN.html)のセレクタには影響させない。
   ======================================== */
body.blog-index-page {
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic Medium', 'Meiryo', 'MS Gothic', sans-serif;
  background-color: var(--bg-light, #F7FAFC);
  color: var(--text-dark, #1A202C);
  display: block;
}

body.blog-index-page a {
  color: inherit;
}

body.blog-index-page a:hover {
  text-decoration: none;
}

/* 固定ヘッダー(styles.css .header)の文字色を本体トーンに戻す */
body.blog-index-page .header {
  color: var(--text-dark, #1A202C);
}

/* 本体フッター(ダーク)の配色を styles.css と同じに戻す */
body.blog-index-page .footer .footer-section h3 {
  color: var(--accent-color, #D6BCFA);
}

body.blog-index-page .footer .footer-section h4 {
  color: var(--accent-color, #D6BCFA);
}

body.blog-index-page .footer .footer-section p {
  color: rgba(255, 255, 255, 0.8);
}

body.blog-index-page .footer .footer-section a {
  color: rgba(255, 255, 255, 0.8);
}

body.blog-index-page .footer .footer-section a:hover {
  color: var(--accent-color, #D6BCFA);
  text-decoration: none;
}

body.blog-index-page .footer .footer-links a {
  color: rgba(255, 255, 255, 0.6);
}

body.blog-index-page .footer .footer-links a:hover {
  color: #fff;
}

body.blog-index-page .footer {
  margin-top: 4rem;
}

/* 2カラムレイアウト: メイン + 右サイドバー300px */
.blog-index-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2.5rem;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 120px 20px 2rem; /* 固定ヘッダー分のオフセット */
}

.blog-index-layout .bi-main {
  min-width: 0;
}

.blog-index-layout .bi-page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.2rem;
  border-bottom: 3px solid var(--accent-color, #D6BCFA);
}

.blog-index-layout .bi-page-header h1 {
  font-size: 2.2rem;
  color: var(--primary-color, #6B46C1);
  margin-bottom: 0.5rem;
}

.blog-index-layout .bi-page-header p {
  color: var(--text-light, #4A5568);
  margin-bottom: 0;
  font-size: 1rem;
}

/* 記事カード: 横3枚グリッド */
.blog-index-layout .bi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.blog-index-layout .bi-card {
  background: var(--white, #FFFFFF);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.blog-index-layout .bi-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.blog-index-layout .bi-card > a {
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.blog-index-layout .bi-card-thumb {
  position: relative;
  padding-top: 56.25%; /* 16:9 */
  background: var(--bg-light, #F7FAFC);
  overflow: hidden;
}

.blog-index-layout .bi-card-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.3s ease;
}

.blog-index-layout .bi-card:hover .bi-card-thumb img {
  transform: scale(1.05);
}

.blog-index-layout .bi-card-body {
  padding: 1.2rem 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-index-layout .bi-card-body time {
  font-size: 0.85rem;
  color: var(--text-light, #4A5568);
  margin-bottom: 0.4rem;
  display: block;
}

.blog-index-layout .bi-card-body h2 {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--primary-color, #6B46C1);
  margin-bottom: 0.6rem;
}

.blog-index-layout .bi-card-body p {
  font-size: 0.9rem;
  color: var(--text-light, #4A5568);
  line-height: 1.7;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* サイドバー */
.blog-index-layout .bi-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.blog-index-layout .bi-widget {
  background: var(--white, #FFFFFF);
  border-radius: 12px;
  padding: 1.2rem;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
}

.blog-index-layout .bi-widget h2 {
  font-size: 1rem;
  color: var(--primary-color, #6B46C1);
  border-bottom: 2px solid var(--bg-light, #F7FAFC);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}

.blog-index-layout .bi-ad {
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.blog-index-layout .bi-ad img {
  max-width: 100%;
  height: auto;
}

.blog-index-layout .bi-ad .amazon-banner {
  margin: 0;
  width: 100%;
}

.blog-index-layout .bi-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.blog-index-layout .bi-links li {
  margin-bottom: 0.5rem;
}

.blog-index-layout .bi-links a {
  display: block;
  padding: 0.4rem 0.2rem;
  color: var(--text-dark, #1A202C);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.blog-index-layout .bi-links a:hover {
  color: var(--primary-color, #6B46C1);
  padding-left: 0.5rem;
}

/* レスポンシブ: ~1200pxでカード2列 */
@media (max-width: 1200px) {
  .blog-index-layout .bi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ~991pxで2カラムレイアウトを1カラム化（サイドバーは下） */
@media (max-width: 991px) {
  .blog-index-layout {
    grid-template-columns: 1fr;
  }
}

/* ~768pxでカード1列 */
@media (max-width: 768px) {
  .blog-index-layout {
    padding-top: 100px;
  }

  .blog-index-layout .bi-grid {
    grid-template-columns: 1fr;
  }

  .blog-index-layout .bi-page-header h1 {
    font-size: 1.75rem;
  }
}

/* Mobile news-commentary readability baseline (shared site-local rule). */
@media (max-width: 768px) {
  .blog-main, .blog-container, .two-col-layout { min-width: 0; }
  .article-detail, .blog-article, .article-body { min-width: 0; }
  .article-detail .article-body, .blog-article { padding-inline: 16px; }
  .article-content {
    font-size: 1rem;
    line-height: 1.85;
    overflow-wrap: anywhere;
  }
  .article-content h2 { font-size: clamp(1.25rem, 6vw, 1.45rem); line-height: 1.4; }
  .article-content h3 { font-size: clamp(1.12rem, 5vw, 1.25rem); line-height: 1.45; }
  .article-content :is(img, iframe, video) { max-width: 100%; height: auto; }
  .article-content table { display: block; max-width: 100%; overflow-x: auto; }
  .sidebar, .blog-sidebar { position: static; order: 2; }
}
/* Mobile article reading width: keep outer page gutters, remove duplicated inner gutters. */
@media (max-width: 768px) {
  .article-content,
  .article-detail .article-body,
  .blog-article,
  .main-content > article.main-content {
    padding-left: 0;
    padding-right: 0;
  }
  /* Cap article-panel padding without removing deliberate card framing. */
  .article-panel,
  .article-main,
  .post-content,
  .article-detail {
    padding-left: min(16px, 4vw);
    padding-right: min(16px, 4vw);
  }
  .article-body { padding-left: 0; padding-right: 0; }
}
