/* blog.css - Notion Design System */

/* ========================================
   Notion Design System
   - Font: Inter (Google Fonts)
   - Colors: Warm White, Near-Black, Notion Blue
   - Borders: 1px solid rgba(0,0,0,0.1)
   - Shadows: 4-5 layer low opacity stack
   - Spacing: 8px base, 64-120px vertical rhythm
   ======================================== */

/* Google Fonts - Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* CSS Variables */
:root {
  /* Colors */
  --notion-bg: #f6f5f4;
  --notion-surface: #ffffff;
  --notion-text: rgba(0, 0, 0, 0.95);
  --notion-text-secondary: rgba(0, 0, 0, 0.65);
  --notion-text-tertiary: rgba(0, 0, 0, 0.45);
  --notion-blue: #0075de;
  --notion-blue-hover: #005fb8;
  --notion-border: rgba(0, 0, 0, 0.1);
  --notion-border-hover: rgba(0, 0, 0, 0.2);
  
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  
  /* Spacing */
  --spacing-base: 8px;
  --spacing-section: 64px;
  --spacing-section-lg: 96px;
  
  /* Layout */
  --max-width: 1200px;
  --content-width: 720px;
  --sidebar-width: 320px;
  
  /* Header */
  --header-height: 80px;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.6;
  color: var(--notion-text);
  background-color: var(--notion-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--notion-blue);
  color: #fff;
  padding: 8px 16px;
  z-index: 1001;
  font-weight: 600;
  transition: top 0.2s;
}

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

/* ========================================
   Header (same structure as main site)
   ======================================== */
body > header {
  background: var(--notion-surface);
  border-bottom: 1px solid var(--notion-border);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.logo a {
  text-decoration: none;
  color: var(--notion-text);
  transition: color 0.2s;
}

.logo a:hover {
  color: var(--notion-blue);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
  max-width: 900px;
  justify-content: center;
}

.nav-item a {
  font-weight: 500;
  color: var(--notion-text-secondary);
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 0.9rem;
  white-space: nowrap;
  text-decoration: none;
}

.nav-item a:hover {
  background-color: var(--notion-bg);
  color: var(--notion-blue);
}

/* ========================================
   Main Layout
   ======================================== */
.blog-main {
  min-height: calc(100vh - var(--header-height));
  padding: var(--spacing-section) 0;
}

.blog-container {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: 40px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  align-items: start;
}

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

/* ========================================
   Blog Index Page
   ======================================== */
.blog-index-header {
  text-align: center;
  margin-bottom: var(--spacing-section);
  padding: 0 24px;
}

.blog-index-header h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
  color: var(--notion-text);
}

.blog-index-header p {
  font-size: 1.125rem;
  color: var(--notion-text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Blog Posts Grid */
.blog-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Blog Card - Notion Style */
.blog-card {
  background: var(--notion-surface);
  border: 1px solid var(--notion-border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.04);
}

.blog-card:hover {
  transform: translateY(-2px);
  border-color: var(--notion-border-hover);
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 4px 8px rgba(0, 0, 0, 0.04),
    0 8px 16px rgba(0, 0, 0, 0.04);
}

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

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

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

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

/* Card Body */
.card-body {
  padding: 20px;
}

.card-body time {
  display: block;
  font-size: 0.875rem;
  color: var(--notion-text-tertiary);
  margin-bottom: 8px;
  font-weight: 500;
}

.card-body h3 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--notion-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

/* ========================================
   Article Detail Page
   ======================================== */
.article-header {
  position: static;
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--notion-border);
}

.article-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
  color: var(--notion-text);
}

.article-meta {
  display: flex;
  gap: 16px;
  font-size: 0.95rem;
  color: var(--notion-text-tertiary);
  margin-bottom: 16px;
}

.article-meta time {
  font-weight: 500;
}

.read-time {
  padding: 2px 8px;
  background: var(--notion-bg);
  border-radius: 4px;
  font-size: 0.875rem;
}

.article-description {
  font-size: 1.125rem;
  color: var(--notion-text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* Hero Image (Eye-catch for article) */
.article-hero-image {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 32px;
  border: 1px solid var(--notion-border);
}

/* Article Content */
.article-content {
  color: var(--notion-text);
  line-height: 1.8;
  font-size: 1.0625rem;
}

.article-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--notion-text);
  margin: 48px 0 16px;
  letter-spacing: -0.015em;
}

.article-content h2:first-child {
  margin-top: 0;
}

.article-content h3 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--notion-text);
  margin: 32px 0 12px;
  letter-spacing: -0.01em;
}

.article-content h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--notion-text);
  margin: 24px 0 12px;
}

.article-content p {
  margin-bottom: 20px;
  color: var(--notion-text);
}

.article-content a {
  color: var(--notion-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-content a:hover {
  color: var(--notion-blue-hover);
}

.article-content ul,
.article-content ol {
  margin: 20px 0 20px 24px;
  padding: 0;
}

.article-content li {
  color: var(--notion-text);
  margin-bottom: 10px;
  line-height: 1.7;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 24px 0;
  border: 1px solid var(--notion-border);
}

.article-content blockquote {
  border-left: 3px solid var(--notion-blue);
  margin: 24px 0;
  padding: 16px 16px 16px 20px;
  color: var(--notion-text-secondary);
  font-style: italic;
  background: var(--notion-bg);
  border-radius: 0 8px 8px 0;
}

.article-content strong {
  color: var(--notion-text);
  font-weight: 600;
}

.article-content code {
  background: var(--notion-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.article-content pre {
  background: var(--notion-bg);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--notion-border);
}

.article-content pre code {
  background: none;
  padding: 0;
}

/* Highlight Box */
.highlight-box,
.data-reference {
  background: var(--notion-surface);
  border: 1px solid var(--notion-border);
  border-radius: 8px;
  padding: 20px;
  margin: 24px 0;
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.04);
}

.highlight-box h3,
.data-reference h3 {
  margin-top: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--notion-text);
}

/* Table of Contents (in-content) */
.toc-container {
  background: var(--notion-surface);
  border: 1px solid var(--notion-border);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 24px 0;
  font-size: 0.95rem;
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.04);
}

.toc-container summary {
  cursor: pointer;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--notion-text);
  list-style: none;
}

.toc-container summary::-webkit-details-marker {
  display: none;
}

.toc-list {
  margin: 0;
  padding-left: 20px;
}

.toc-list li {
  margin: 8px 0;
  line-height: 1.5;
  color: var(--notion-text-secondary);
}

.toc-list .toc-sub {
  margin-left: 16px;
  font-size: 0.875rem;
  list-style-type: disc;
}

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

.toc-list a:hover {
  text-decoration: underline;
}

/* Share Links */
.share-links {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--notion-border);
}

.share-links p {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--notion-text);
  margin-bottom: 16px;
}

.share-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.share-buttons a {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid var(--notion-border);
  border-radius: 6px;
  color: var(--notion-blue);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  background: var(--notion-surface);
  text-decoration: none;
}

.share-buttons a:hover {
  border-color: var(--notion-blue);
  color: var(--notion-blue-hover);
  background: var(--notion-bg);
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  align-self: start;
}

.sidebar-section {
  background: var(--notion-surface);
  border: 1px solid var(--notion-border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.04);
}

.sidebar-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--notion-text);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--notion-border);
  letter-spacing: -0.01em;
}

.sidebar-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-section li {
  margin-bottom: 10px;
}

.sidebar-section a {
  color: var(--notion-text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.2s;
  display: block;
  padding: 4px 0;
}

.sidebar-section a:hover {
  color: var(--notion-blue);
}

/* Ad Space */
.ad-space {
  padding: 16px;
  text-align: center;
}

.ad-space img {
  max-width: 100%;
  border-radius: 6px;
  transition: opacity 0.2s;
}

.ad-space img:hover {
  opacity: 0.9;
}

.ad-space a {
  display: inline-block;
}

/* ========================================
   Footer (same structure as main site)
   ======================================== */
footer {
  background: var(--notion-text);
  color: #fff;
  text-align: center;
  padding: 48px 24px;
  margin-top: var(--spacing-section);
}

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

.footer-container p {
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}

.footer-links {
  margin-top: 16px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  margin: 0 8px;
  font-size: 0.9rem;
  transition: color 0.2s;
}

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

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 900px) {
  .blog-container {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .sidebar {
    position: static;
  }
  
  .blog-posts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --spacing-section: 48px;
  }
  
  .header-container {
    padding: 12px 16px;
  }
  
  .nav-menu {
    gap: 0.75rem;
  }
  
  .nav-item a {
    padding: 6px 10px;
    font-size: 0.85rem;
  }
  
  .blog-index-header h1 {
    font-size: 2rem;
  }
  
  .blog-index-header p {
    font-size: 1rem;
  }
  
  .article-title {
    font-size: 1.75rem;
  }
  
  .article-meta {
    flex-direction: column;
    gap: 8px;
  }
  
  .article-content {
    font-size: 1rem;
  }
  
  .article-content h2 {
    font-size: 1.5rem;
  }
  
  .article-content h3 {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .blog-posts-grid {
    padding: 0 16px;
  }

  .card-body {
    padding: 16px;
  }

  .share-buttons {
    flex-direction: column;
  }

  .share-buttons a {
    text-align: center;
  }
}

/* ========================================
   Blog Index Page Layout (一覧ページ専用)
   2026-07 改修: 本体サイトのトーンに合わせた
   2カラム（メイン + サイドバー300px）構成。
   記事ページ（20YYMMDD-NN.html）のセレクタには影響しない。
   ======================================== */

/* 本体サイト（css/styles.css）とトーンを揃えるための上書き */
body.blog-index-page {
  background-color: var(--bg-color, #f9f9f9);
}

body.blog-index-page header {
  border-bottom: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

body.blog-index-page .logo {
  font-size: 1.8rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

body.blog-index-page .logo a {
  color: var(--primary-color, #2c3e50);
}

body.blog-index-page .nav-item a {
  color: var(--text-dark, #333);
}

body.blog-index-page .nav-item a:hover {
  background-color: var(--primary-color, #2c3e50);
  color: var(--text-light, #fff);
}

body.blog-index-page footer {
  background: var(--primary-color, #2c3e50);
}

/* レイアウト全体 */
.blog-index-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.blog-index-layout .blog-index-header {
  padding: 0;
  margin-bottom: 40px;
}

.blog-index-layout .blog-index-header h1 {
  color: var(--primary-color, #2c3e50);
  border-bottom: none;
  padding-bottom: 0;
}

/* 2カラム: メイン + 右サイドバー300px */
.blog-index-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
}

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

/* 記事カード: 横3枚グリッド */
.blog-index-layout .blog-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: none;
  padding: 0;
  margin: 0;
}

/* The published index uses .blog-index-grid; keep its cards in normal flow. */
.blog-index-layout .blog-index-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  width: 100%;
  min-width: 0;
}

.blog-index-layout .blog-index-grid > .blog-card {
  position: relative;
  display: block;
  min-width: 0;
  visibility: visible;
  opacity: 1;
}

.blog-index-layout .blog-index-grid > .blog-card > a {
  display: block;
}

@media (max-width: 1200px) {
  .blog-index-layout .blog-index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .blog-index-layout .blog-index-grid { grid-template-columns: 1fr; }
}

/* カードタイトル（h2）: styles.css のグローバル h2 装飾を打ち消す */
.blog-index-layout .card-body h2 {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  padding-bottom: 0;
  border-bottom: none;
  color: var(--text-dark, #333);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-index-layout .card-body p {
  font-size: 0.875rem;
  margin-bottom: 0;
}

.blog-index-layout .blog-card a:hover .card-body h2 {
  color: var(--accent-color, #e67e22);
}

/* サイドバー */
.blog-index-sidebar {
  min-width: 0;
}

.blog-index-sidebar .sidebar-section h3 {
  color: var(--primary-color, #2c3e50);
  border-bottom: 2px solid var(--accent-color, #e67e22);
}

.blog-index-sidebar .sidebar-note {
  font-size: 0.875rem;
  color: var(--text-dark, #333);
  line-height: 1.7;
  margin: 0;
}

.blog-index-sidebar .ad-label {
  font-size: 0.75rem;
  color: var(--notion-text-tertiary, rgba(0, 0, 0, 0.45));
  margin: 0 0 10px;
  text-align: center;
  letter-spacing: 0.05em;
}

/* Amazon テキストバナー */
.blog-index-sidebar .amazon-banner a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--accent-color, #e67e22);
  border-radius: 8px;
  color: var(--accent-color, #e67e22);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s ease;
}

.blog-index-sidebar .amazon-banner a:hover {
  background-color: var(--accent-color, #e67e22);
  color: #fff;
}

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

@media (max-width: 991px) {
  .blog-index-columns {
    grid-template-columns: 1fr;
  }

  .blog-index-sidebar {
    max-width: 480px;
  }
}

@media (max-width: 768px) {
  .blog-index-layout {
    padding: 32px 16px 48px;
  }

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

/* 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; }
}

/* Blog index card grid fallback: scoped to index-only markup. */
.blog-index-layout {
  display: block;
  gap: 28px;
  align-items: start;
}

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

.blog-index-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.blog-index-grid .blog-card { display: flex; flex-direction: column; }

.blog-index-grid .blog-card > a {
  color: inherit;
  text-decoration: none;
}

.blog-index-grid .card-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.blog-index-grid .card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-index-grid .card-body { padding: 24px; }

@media (max-width: 1200px) {
  .blog-index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .blog-index-layout { grid-template-columns: 1fr; }
  .blog-index-grid { grid-template-columns: 1fr; }
}
/* 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; }
}
