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

:root {
  /* Color Palette - AI Solutions Theme */
  --primary-color: #1e40af;
  --secondary-color: #0f172a;
  --accent-color: #3b82f6;
  --text-primary: #1a1a1a;
  --text-secondary: #4a5568;
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --gradient-primary: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  --gradient-dark: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-primary);
  background-color: var(--bg-white);
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-top: 2.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-color);
}
h3 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  margin-top: 2rem;
  color: var(--primary-color);
}

p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

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

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

/* Navigation */
.main-nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  transition: var(--transition);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-logo {
  display: flex;
  flex-direction: column;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  align-items: center;
}

.nav-menu li {
  white-space: nowrap;
}

.nav-item a {
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: var(--transition);
}

.nav-item a:hover,
.nav-item a.active {
  background: var(--gradient-primary);
  color: white;
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger-inner {
  width: 25px;
  height: 3px;
  background: var(--primary-color);
  margin: 3px 0;
  transition: var(--transition);
}

/* Blog Container */
.blog-container,
.container {
  max-width: 1200px;
  margin: 100px auto 0;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 3rem;
}

.main-content {
  background: var(--bg-white);
  padding: 3rem;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.post-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.blog-hero-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

/* 画像全般のレスポンシブ対応 */
img {
  max-width: 100%;
  height: auto;
}

/* Featured Image (メイン画像のサイズ制御) */
.featured-image {
  width: 100%;
  max-width: 100%;
  max-height: 350px;
  height: auto;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

/* Article Header (blog/news記事のヘッダー構造) */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.article-title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

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

.article-content {
  margin-top: 2rem;
}

/* Blog Header (blog-headerもサポート) */
.blog-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

/* ハイライトボックス */
.highlight-box {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: 12px;
  border-left: 4px solid var(--primary-color);
  margin: 2rem 0;
}

.highlight-box h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.highlight-box ul {
  margin: 0;
  padding-left: 1.5rem;
}

/* データ参照ボックス */
.data-reference {
  background: #f0f9ff;
  border-left: 4px solid var(--accent-color);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 8px;
}

.data-reference p {
  margin-bottom: 0.5rem;
}

.data-source {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 1rem;
}

/* ソーシャルシェアボタン */
.social-share {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.social-share p {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
}

/* 広告バナー */
.ad-banner {
  text-align: center;
  margin: 2rem 0;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  overflow: hidden;
}

.ad-banner img {
  max-width: 100%;
  height: auto;
}

.blog-content ul,
.blog-content ol {
  margin: 1.5rem 0 1.5rem 2rem;
  color: var(--text-secondary);
}

.blog-content li {
  margin-bottom: 0.75rem;
  line-height: 1.8;
}

pre {
  overflow-x: auto;
  max-width: 100%;
  background: #f5f5f5;
  padding: 1rem;
  border-radius: 4px;
  margin: 1.5rem 0;
  border-left: 4px solid var(--primary-color);
}

pre code {
  display: block;
  white-space: pre;
  word-wrap: normal;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

.share-buttons {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-light);
  border-radius: 12px;
}

.share-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  color: white;
  transition: var(--transition);
  text-decoration: none;
}

.share-button.twitter {
  background: #1DA1F2;
}

.share-button.twitter:hover {
  background: #1a8cd8;
  transform: translateY(-2px);
}

.share-button.facebook {
  background: #1877F2;
}

.share-button.facebook:hover {
  background: #1664d8;
  transform: translateY(-2px);
}

.cta-section {
  background: var(--gradient-primary);
  color: white;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  margin: 3rem 0;
}

.cta-section h3 {
  color: white;
  margin-bottom: 1rem;
}

.cta-section p {
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 1.5rem;
}

.cta-button {
  display: inline-block;
  background: white;
  color: var(--primary-color);
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  transition: var(--transition);
}

.sidebar {
  position: sticky;
  top: 120px;
  height: fit-content;
}

.sidebar-section {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.sidebar-section h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.1rem;
  margin-top: 0;
}

.toc ul {
  list-style: none;
  margin: 0;
}

.toc li {
  margin-bottom: 0.75rem;
}

.toc a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: var(--transition);
  display: block;
}

.toc a:hover {
  color: var(--primary-color);
  padding-left: 0.5rem;
}

.related-links ul {
  list-style: none;
  margin: 0;
}

.related-links li {
  margin-bottom: 0.75rem;
}

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

.ad-space {
  background: var(--gradient-dark);
  color: white;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
}

.ad-placeholder p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  margin: 0;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.blog-card {
  background: var(--bg-white);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: var(--transition);
}

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

.blog-thumbnail {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.blog-card-content {
  padding: 1.5rem;
}

.blog-card h2 {
  font-size: 1.5rem;
  margin: 0 0 0.75rem 0;
  border: none;
  padding: 0;
}

.blog-card h2 a {
  color: var(--text-primary);
}

.blog-card time {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.article-summary {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.read-more {
  display: inline-block;
  color: var(--primary-color);
  font-weight: 600;
  transition: var(--transition);
}

.footer {
  background: var(--gradient-dark);
  color: white;
  padding: 3rem 0 1rem;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h4 {
  margin-bottom: 1rem;
  color: white;
}

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

.footer-section li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: rgba(255, 255, 255, 0.8);
  transition: var(--transition);
}

.footer-bottom {
  text-align: center;
  padding: 2rem 2rem 0;
  max-width: 1200px;
  margin: 0 auto;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--transition);
}

/* 1024px以下でも2カラムを維持（768px以下で1カラムに切り替え） */
@media (max-width: 1024px) {
  .blog-container,
  .container {
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 15px;
  }
  .nav-menu {
    position: fixed;
    top: 80px;
    left: -100%;
    flex-direction: column;
    background: white;
    width: 100%;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
  }
  .nav-menu.active {
    left: 0;
  }
  .hamburger {
    display: flex;
  }
  .blog-container,
  .container {
    margin-top: 80px;
    padding: 1rem;
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .main-content {
    padding: 2rem 1.5rem;
  }
  /* サイドバーをモバイルで本文の上に表示 */
  .sidebar {
    order: -1;
    position: static;
  }

  /* 画像のモバイル対応 */
  .blog-hero-image {
    border-radius: 8px;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    width: calc(100% + 3rem);
    max-width: calc(100% + 3rem);
  }

  /* 広告バナーのモバイル対応 */
  .ad-banner {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding: 1rem 0.5rem;
  }

  .ad-banner img {
    max-width: 100%;
    height: auto;
    width: auto;
  }

  /* サイドバー広告 */
  .ad-space {
    text-align: center;
  }

  .ad-space img {
    max-width: 100%;
    height: auto;
    width: auto;
  }

  /* ハイライトボックスのモバイル対応 */
  .highlight-box {
    padding: 1rem;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    border-radius: 0;
  }

  /* データ参照ボックスのモバイル対応 */
  .data-reference {
    padding: 1rem;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    border-radius: 0;
  }

  /* ソーシャルシェアボタンのモバイル対応 */
  .social-share {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .share-button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }
  .blog-container {
    padding: 0.5rem;
  }
  .main-content {
    padding: 1.5rem 1rem;
  }
  pre {
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0;
    overflow-x: auto;
  }

  pre code {
    font-size: 0.8rem;
  }

  /* 画像のモバイル対応（極小画面） */
  .blog-hero-image {
    margin-left: -1rem;
    margin-right: -1rem;
    width: calc(100% + 2rem);
    max-width: calc(100% + 2rem);
    border-radius: 0;
  }

  /* 広告バナーのモバイル対応（極小画面） */
  .ad-banner {
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0.5rem;
    border-radius: 0;
  }

  /* ハイライトボックスのモバイル対応（極小画面） */
  .highlight-box {
    padding: 0.75rem;
    margin-left: -1rem;
    margin-right: -1rem;
  }

  .highlight-box ul {
    padding-left: 1.25rem;
  }

  /* データ参照ボックスのモバイル対応（極小画面） */
  .data-reference {
    padding: 0.75rem;
    margin-left: -1rem;
    margin-right: -1rem;
    font-size: 0.9rem;
  }

  /* ソーシャルシェアボタンのモバイル対応（極小画面） */
  .share-button {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  /* ナビゲーションのモバイル対応 */
  .nav-container {
    padding: 0.75rem 1rem;
  }

  .logo-text {
    font-size: 1.25rem;
  }

  .logo-sub {
    font-size: 0.75rem;
  }
}
