/* ==========================================
   記事用スタイルシート - WordPress風デザイン
   Tailwind CSSと併用前提
   ========================================== */

/* フォント読み込み */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700;900&family=Noto+Serif+JP:wght@400;700&display=swap');

/* CSS変数定義 */
:root {
  /* カラーパレット */
  --article-primary: #2271b1;
  --article-primary-dark: #135e96;
  --article-accent: #f0b849;
  --article-table-header: #4a90e2;

  /* フォントファミリー */
  --article-font-sans: 'Noto Sans JP', sans-serif;
  --article-font-serif: 'Noto Serif JP', serif;
}

/* ==========================================
   ベースコンテナ
   ========================================== */
.article-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  padding: 3rem 2rem;
  /* margin: 2rem auto; */
}

.article-content {
  font-family: var(--article-font-sans);
  color: #2c3e50;
  line-height: 1.8;
}

/* ==========================================
   見出し
   ========================================== */

/* メインタイトル */
.article-content .article-title {
  font-family: var(--article-font-sans);
  font-size: clamp(3rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 2rem;
  color: #fff;
  text-align: center;
  padding: 3rem 2rem;
  margin-left: -2rem;
  margin-right: -2rem;
  background: var(--article-primary);
  border-radius: 0;
  box-shadow: 0 10px 30px rgba(34, 113, 177, 0.3);
}

/* H2 - リボンデザイン */
.article-content h2 {
  position: relative;
  font-family: var(--article-font-sans);
  font-size: 2rem;
  font-weight: 700;
  color: white;
  background: var(--article-primary);
  padding: 1rem 2rem 1rem 3rem;
  margin: 2rem -2rem 2rem -2rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* リボンの影 */
.article-content h2::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  border-style: solid;
  border-width: 0 1rem 1rem 0;
  border-color: transparent var(--article-primary-dark) transparent transparent;
}

/* リボンのアイコン */
.article-content h2::after {
  content: '✦';
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--article-accent);
}

/* H3 - グラデーション下線 */
.article-content h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2c3e50;
  position: relative;
  padding-bottom: 0.75rem;
  margin: 2.5rem 0 1.5rem;
}

.article-content h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  border-radius: 2px;
}

/* H4 - 左ボーダー */
.article-content h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--article-primary);
  border-left: 4px solid var(--article-primary);
  padding-left: 1rem;
  margin: 2rem 0 1rem;
}

/* ==========================================
   本文
   ========================================== */

/* 段落 */
.article-content p {
  margin-bottom: 1.75rem;
  font-size: 1.0625rem;
  text-align: justify;
}

/* リード文（最初の段落） */
.article-content p:first-of-type {
  font-size: 1.25rem;
  font-weight: 300;
  color: #546e7a;
  line-height: 1.8;
}

/* ==========================================
   リンク
   ========================================== */
/* デフォルト: シンプルなリンク（文章中） */
.article-content a {
  /* color: var(--article-primary); */
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  /* text-decoration-color: rgba(0, 123, 255, 0.3); */
  transition: all 0.3s ease;
}

.article-content a:hover {
  color: var(--article-primary-dark);
  text-decoration-color: var(--article-primary);
}

/* 特別なリンク: アニメーション付き */
.article-content a.link-accent {
  text-decoration: none;
  position: relative;
  font-weight: 500;
}

.article-content a.link-accent::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  transition: width 0.3s ease;
}

.article-content a.link-accent:hover {
  color: var(--article-primary-dark);
}

.article-content a.link-accent:hover::after {
  width: 100%;
}

/* キャプション内のリンクは装飾なし */
.image-caption a {
  text-decoration: underline !important;
  text-underline-offset: 2px !important;
  text-decoration-thickness: 1px !important;
  text-decoration-color: #999 !important;
  font-weight: normal !important;
}

.image-caption a::after {
  display: none !important;
}

.image-caption a:hover {
  color: #666 !important;
  text-decoration-color: #666 !important;
}

/* ==========================================
   リスト
   ========================================== */

/* 順序なしリスト */
.article-content ul {
  list-style: none;
  padding-left: 1.5rem;
  margin: 1.5rem 0;
}

.article-content ul li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.5rem;
}

.article-content ul li::before {
  content: '–';
  position: absolute;
  left: -1rem;
  color: #666;
}

/* ネストしたリスト */
.article-content ul ul,
.article-content ol ul {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* 順序付きリスト */
.article-content ol {
  list-style: decimal;
  padding-left: 2rem;
  margin: 1.5rem 0;
}

.article-content ol li {
  margin-bottom: 0.5rem;
}

/* ネストした順序付きリスト */
.article-content ol ol {
  list-style-type: lower-alpha;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* ==========================================
   引用
   ========================================== */
.article-content blockquote {
  position: relative;
  background: #f8f9fa;
  border-left: 5px solid var(--article-primary);
  border-radius: 0 8px 8px 0;
  padding: 2rem 2rem 2rem 3rem;
  margin: 2rem 0;
  font-style: italic;
  color: #34495e;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.article-content blockquote::before {
  content: '"';
  position: absolute;
  top: 0.5rem;
  left: 1rem;
  font-size: 3rem;
  color: var(--article-primary);
  opacity: 0.2;
  font-family: Georgia, serif;
}

/* 引用元 */
.article-content blockquote cite {
  display: block;
  margin-top: 1rem;
  font-size: 0.875rem;
  font-style: normal;
  color: #666;
  text-align: right;
}

.article-content blockquote cite a {
  color: var(--article-primary);
  text-decoration: underline;
}

/* ==========================================
   コード
   ========================================== */
.article-content code {
  background: #f0f0f0;
  color: #e83e8c;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875em;
  font-weight: 500;
}

.article-content pre {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
  overflow-x: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  position: relative;
}

.article-content pre::before {
  content: 'CODE';
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  font-size: 0.75rem;
  color: #858585;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.article-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* ==========================================
   テーブル
   ========================================== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* iOS スムーススクロール */
}

/* スクロールバーのスタイル改善 */
.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  /* margin: 2rem 0; */
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.article-table {
  table-layout: auto;
  min-width: 800px;
}

/* エリア列（5列目）の改行禁止 */
.article-table th:nth-child(5),
.article-table td:nth-child(5) {
  white-space: nowrap;
}

/* 評価列（4列目）の改行禁止 */
.article-table th:nth-child(4),
.article-table td:nth-child(4) {
  white-space: nowrap;
}

/* 価格帯列（2列目）の改行禁止 */
.article-table th:nth-child(2),
.article-table td:nth-child(2) {
  white-space: nowrap;
}

.article-content thead {
  background: var(--article-table-header);
  color: white;
}

.article-content th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.article-content td {
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

.article-content tbody tr:hover {
  background: #f5f5f5;
  transition: background 0.2s ease;
}

.article-content tbody tr:last-child td {
  border-bottom: none;
}

/* ==========================================
   装飾要素
   ========================================== */

/* 章番号 */
.chapter-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--article-primary);
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  border-radius: 8px;
  margin-right: 1rem;
  box-shadow: 0 3px 10px rgba(34, 113, 177, 0.2);
}

/* 強調 */
.article-content strong {
  font-weight: 700;
  color: var(--article-primary-dark);
}

.article-content em {
  font-style: italic;
  color: #546e7a;
  font-weight: 500;
}

/* 水平線 */
.article-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #ccc, transparent);
  margin: 3rem 0;
  position: relative;
}

.article-content hr::after {
  content: '◆';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 0 1rem;
  color: #ccc;
  font-size: 1.25rem;
}

/* 蛍光ペン風ハイライト */
.highlight {
  background: linear-gradient(180deg, transparent 60%, #ffeb3b 60%);
  padding: 0 0.25rem;
  font-weight: 500;
}

/* ==========================================
   リンクプレビュー
   ========================================== */
.link-preview {
  margin: 2rem 0;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.link-preview:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.link-preview .preview-link {
  display: flex;
  text-decoration: none;
  color: inherit;
  min-height: 150px;
}

.link-preview .preview-image {
  flex-shrink: 0;
  width: 200px;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  align-items: stretch;
}

.link-preview .preview-image .image-container {
  width: 100%;
  height: 100%;
  margin: 0;
}

.link-preview .preview-image .image-container figure {
  margin: 0;
  height: 100%;
  width: 100%;
}

.link-preview .preview-image picture {
  display: block;
  width: 100%;
  height: 100%;
}

.link-preview .preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 150px;
}

.link-preview .preview-content {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: space-between;
}

.link-preview .preview-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview .preview-description {
  margin: 0;
  font-size: 0.875rem;
  color: #666;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview .preview-domain {
  font-size: 0.75rem;
  color: #999;
  margin-top: auto;
}

/* モバイル対応 */
@media (max-width: 640px) {
  .link-preview .preview-link {
    flex-direction: column;
  }

  .link-preview .preview-image {
    width: 100%;
    height: 180px;
  }

  .link-preview .preview-content {
    padding: 1rem;
  }
}

/* ==========================================
   ボックス装飾
   ========================================== */

/* ノートボックス */
.note-box {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 2px solid #2196f3;
  border-radius: 8px;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  position: relative;
  box-shadow: 0 5px 15px rgba(33, 150, 243, 0.1);
}

.note-box::before {
  content: '📝 NOTE';
  position: absolute;
  top: -0.75rem;
  left: 1.5rem;
  background: white;
  padding: 0 0.5rem;
  color: #2196f3;
  font-weight: 700;
  font-size: 0.875rem;
}

/* 重要ボックス */
.important-box {
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
  border: 2px solid #f44336;
  border-radius: 8px;
  padding: 1.5rem 2rem 1.5rem 3.5rem;
  margin: 2rem 0;
  position: relative;
  box-shadow: 0 5px 15px rgba(244, 67, 54, 0.1);
}

.important-box::before {
  content: '⚠️';
  position: absolute;
  left: 1rem;
  top: 1.5rem;
  font-size: 1.5rem;
}

/* ヒントボックス */
.tip-box {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border: 2px solid #4caf50;
  border-radius: 8px;
  padding: 1.5rem 2rem 1.5rem 3.5rem;
  margin: 2rem 0;
  position: relative;
  box-shadow: 0 5px 15px rgba(76, 175, 80, 0.1);
}

.tip-box::before {
  content: '💡';
  position: absolute;
  left: 1rem;
  top: 1.5rem;
  font-size: 1.5rem;
}

/* ==========================================
   画像とメディア
   ========================================== */
   .article-content figure,
   .article-content .article-figure {
     width: 100%;
     margin: 1.5rem 0;
   }

   .article-content picture {
     width: 100%;
     display: block;
   }

   .article-content .responsive-image {
     max-width: 100%;
     width: 100%;
     height: auto;
     display: block;
   }


/* ==========================================
   目次
   ========================================== */
.table-of-contents {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 2rem;
  margin: 3rem 0;
}

.table-of-contents h2 {
  margin: 0 0 1.5rem 0 !important;
  padding: 0 0 1rem 0 !important;
  background: none !important;
  color: var(--article-primary) !important;
  font-size: 1.5rem !important;
  text-align: center;
  box-shadow: none !important;
  border-bottom: 2px solid #e9ecef;
}

/* 目次内ではリボンスタイルを無効化 */
.table-of-contents h2::before,
.table-of-contents h2::after {
  content: none !important;
}

.table-of-contents ol {
  margin: 0;
  padding-left: 0;
}

.table-of-contents li {
  margin-bottom: 1rem;
  padding-left: 2.5rem;
}

.table-of-contents a {
  color: #546e7a;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
}

.table-of-contents a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--article-primary);
  transition: width 0.3s ease;
}

.table-of-contents a:hover {
  color: var(--article-primary);
}

.table-of-contents a:hover::after {
  width: 100%;
}

/* ==========================================
   ボタン
   ========================================== */
.article-button {
  display: inline-block;
  padding: 1rem 2.5rem;
  margin: 1rem 0.5rem;
  background: #fff;
  color: var(--article-primary);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.125rem;
  border: 3px solid var(--article-primary);
  box-shadow: 0 4px 12px rgba(34, 113, 177, 0.15);
  white-space: nowrap;
  min-width: 80px;
}

.article-button:hover {
  transform: translateY(-2px);
  background: var(--article-primary);
  color: white;
  box-shadow: 0 6px 20px rgba(34, 113, 177, 0.3);
  transition: all 0.6s ease;
}

/* ==========================================
   レスポンシブ対応
   ========================================== */
@media (max-width: 768px) {
  .article-container {
    padding: 2rem 1rem;
  }

  .article-content .article-title {
    font-size: 2rem;
    padding: 2rem 1rem;
    margin-left: -1rem;
    margin-right: -1rem;
  }

  .article-content h2 {
    margin-left: -1rem;
    margin-right: -1rem;
    font-size: 1.5rem;
  }

  .article-content h3 {
    font-size: 1.25rem;
  }

  .article-content blockquote {
    padding: 1.5rem 1rem 1.5rem 2rem;
  }
}

/* ==========================================
   アニメーション
   ========================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-content > * {
  animation: fadeInUp 0.6s ease-out;
}
