/*
Theme Name: AIToolLog
Theme URI: https://aitoollog.com
Author: Kei
Description: AIツールログ（aitoollog.com）専用テーマ。海外AIツールのレビュー＋AIニュース向け。カテゴリ配色はサムネ生成パイプラインと同期。
Version: 1.2.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL v2 or later
Text Domain: aitoollog
*/

:root {
  --accent: #4f46e5;
  --accent-dark: #312e81;
  --text: #1f2937;
  --text-light: #6b7280;
  --bg: #f8f9fc;
  --card: #ffffff;
  --border: #e5e7eb;
  --radius: 14px;
}

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

body {
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.9;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ===== ヘッダー ===== */
.site-header {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  padding: 26px 0 22px;
}
.site-header a { color: #fff; text-decoration: none; }
.site-title { font-size: 30px; font-weight: 800; letter-spacing: .02em; }
.site-title .tld { opacity: .65; font-weight: 600; }
.site-tagline { font-size: 13px; opacity: .85; margin-top: 2px; }

.site-nav { background: #fff; border-bottom: 1px solid var(--border); }
.site-nav ul {
  list-style: none; display: flex; gap: 4px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; padding: 0;
}
.site-nav li { flex-shrink: 0; }
.site-nav a {
  display: block; padding: 12px 14px; color: var(--text);
  font-size: 14px; font-weight: 600; text-decoration: none;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== 2カラムレイアウト（PC: 本文＋サイドバー / モバイル: 縦積み） ===== */
.layout { display: flex; gap: 36px; align-items: flex-start; }
.layout .main-col { flex: 1; min-width: 0; }
.site-aside { width: 300px; flex-shrink: 0; position: sticky; top: 20px; padding: 28px 0 40px; }
@media (max-width: 960px) {
  .layout { display: block; }
  .site-aside { width: auto; position: static; padding-top: 8px; }
}

.aside-box {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px;
}
.aside-title {
  font-size: 15px; font-weight: 800; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 2px solid var(--accent);
}
.aside-profile { display: flex; gap: 12px; align-items: flex-start; }
.aside-profile .avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff; font-size: 19px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.aside-profile .bio { font-size: 13px; color: var(--text-light); line-height: 1.7; }

.aside-cats { list-style: none; }
.aside-cats li { border-bottom: 1px solid var(--border); }
.aside-cats li:last-child { border-bottom: 0; }
.aside-cats a {
  display: flex; align-items: center; gap: 8px; padding: 9px 2px;
  color: var(--text); font-size: 14px; text-decoration: none;
}
.aside-cats a:hover { color: var(--accent); }
.aside-cats .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.aside-cats .count {
  margin-left: auto; font-size: 12px; color: var(--text-light);
  background: var(--bg); border-radius: 999px; padding: 1px 9px;
}

.aside-recent { list-style: none; }
.aside-recent li { border-bottom: 1px solid var(--border); }
.aside-recent li:last-child { border-bottom: 0; }
.aside-recent a {
  display: flex; gap: 10px; align-items: center; padding: 9px 0;
  color: var(--text); font-size: 13px; line-height: 1.6; text-decoration: none;
}
.aside-recent a:hover { color: var(--accent); }
.aside-recent .mini-thumb { flex-shrink: 0; width: 72px; }
.aside-recent .mini-thumb img { width: 72px; height: 38px; object-fit: cover; border-radius: 6px; display: block; }

/* ===== カテゴリバッジ（配色はthumbnail_generator.pyと同期） ===== */
.cat-badge {
  display: inline-block; font-size: 12px; font-weight: 700; color: #fff;
  padding: 3px 12px; border-radius: 999px; text-decoration: none;
  background: var(--accent-dark);
}
a.cat-badge:hover { text-decoration: none; opacity: .85; color: #fff; }

/* ===== 記事カード ===== */
.post-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px;
  margin: 28px 0 48px;
}
@media (max-width: 600px) { .post-grid { grid-template-columns: 1fr; } }

.post-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex; flex-direction: column;
}
.post-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.post-card a.thumb-link { display: block; aspect-ratio: 1200 / 630; background: var(--accent-dark); }
.post-card .thumb-link img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-card .no-thumb {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  padding: 0 16px; text-align: center;
}
.post-card .card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; flex: 1; }
.post-card .card-meta, .post-card h2 { align-self: stretch; }
.post-card h2 { font-size: 16px; line-height: 1.6; }
.post-card h2 a { color: var(--text); text-decoration: none; }
.post-card h2 a:hover { color: var(--accent); }
.post-card .card-meta { margin-top: auto; font-size: 12px; color: var(--text-light); display: flex; gap: 10px; align-items: center; }

/* ===== セクション見出し（トップページ） ===== */
.section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 40px 0 4px; padding-bottom: 10px; border-bottom: 2px solid var(--accent);
}
.section-head h2 { font-size: 20px; }
.section-head .more { margin-left: auto; font-size: 13px; flex-shrink: 0; }

/* ===== AIツール一覧（トップページのディレクトリ） ===== */
.tool-directory { margin-bottom: 8px; }
.tool-directory .tool-count {
  margin-left: auto; font-size: 13px; color: var(--text-light); flex-shrink: 0;
}
.tool-directory-lead { font-size: 14px; color: var(--text-light); margin: 14px 0 4px; }

.tool-cat-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.tool-cat-nav a {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--text); text-decoration: none;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 14px; border-left: 5px solid var(--cat-color, var(--accent));
}
.tool-cat-nav a:hover { color: var(--cat-color, var(--accent)); text-decoration: none; }
.tool-cat-nav .n { font-size: 11px; color: var(--text-light); }

.tool-cat-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; margin: 26px 0 0; scroll-margin-top: 16px;
}
.tool-cat-head .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

.tool-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0 0;
}
@media (max-width: 600px) { .tool-grid { grid-template-columns: 1fr; } }

.tool-card {
  display: block; background: var(--card);
  border: 1px solid var(--border); border-left: 5px solid var(--cat-color, var(--accent));
  border-radius: 10px; padding: 10px 14px; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.tool-card:hover {
  text-decoration: none; transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .1);
}
.tool-card .tool-name {
  display: block; font-size: 15px; font-weight: 800; color: var(--text); line-height: 1.5;
}
.tool-card .tool-name::after { content: " →"; color: var(--cat-color, var(--accent)); font-weight: 700; }
.tool-card:hover .tool-name { color: var(--cat-color, var(--accent)); }
.tool-card .tool-desc {
  display: block; font-size: 12.5px; color: var(--text-light); line-height: 1.6; margin-top: 2px;
}

/* ===== 記事ページ: 関連AIニュース ===== */
.tool-news { margin-top: 48px; }
.tool-news .section-head { margin-top: 0; }
.tool-news .section-head h2 { font-size: 19px; }

/* ===== ニュースリスト（トップページ） ===== */
.news-list { list-style: none; margin: 16px 0 8px; }
.news-list li {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; padding: 10px 16px;
  display: flex; gap: 14px; align-items: center; font-size: 15px;
}
.news-list time { color: var(--text-light); font-size: 12px; flex-shrink: 0; }
.news-list a { color: var(--text); font-weight: 600; }
.news-list a:hover { color: var(--accent); }

/* ===== 記事ページ ===== */
.single-main { max-width: 760px; margin: 0 auto; padding: 36px 20px 60px; }
.entry-header { margin-bottom: 24px; }
.entry-header .cat-badge { margin-bottom: 12px; }
.entry-title { font-size: 30px; line-height: 1.5; margin: 8px 0 12px; }
@media (max-width: 600px) { .entry-title { font-size: 24px; } }
.entry-meta { font-size: 13px; color: var(--text-light); display: flex; gap: 14px; flex-wrap: wrap; }
.entry-thumb { margin: 20px 0 28px; }
.entry-thumb img { border-radius: var(--radius); width: 100%; }

.entry-content { font-size: 16.5px; }
.entry-content p { margin: 0 0 1.6em; }
.entry-content h2 {
  font-size: 23px; margin: 2.2em 0 1em; padding: .5em .8em;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff; border-radius: 10px; line-height: 1.5;
}
.entry-content h3 {
  font-size: 19px; margin: 1.8em 0 .8em; padding: .2em 0 .2em .7em;
  border-left: 5px solid var(--accent); line-height: 1.5;
}
.entry-content ul, .entry-content ol { margin: 0 0 1.6em 1.4em; }
.entry-content li { margin-bottom: .4em; }

/* 料金表など */
.entry-content .table-scroll { overflow-x: auto; margin: 0 0 1.6em; }
.entry-content table {
  border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.7;
  background: var(--card); min-width: 560px;
}
.entry-content th, .entry-content td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; vertical-align: top; }
.entry-content th, .entry-content tr:first-child td:first-child ~ td, .entry-content tr:first-child td {
  background: #eef0fb;
}
.entry-content tr:first-child { background: #eef0fb; font-weight: 700; }

/* 海外の声（blockquote） */
.entry-content blockquote {
  margin: 0 0 1.6em; padding: 14px 20px;
  background: #f1f3fd; border-left: 5px solid var(--accent);
  border-radius: 0 10px 10px 0; font-size: 15.5px; color: #374151;
  position: relative;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }

/* ===== ケイのプロフィールボックス ===== */
.author-box {
  display: flex; gap: 18px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin: 48px 0 0;
}
.author-box .avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff; font-size: 28px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.author-box .name { font-weight: 800; font-size: 15px; margin-bottom: 4px; }
.author-box .bio { font-size: 13.5px; color: var(--text-light); line-height: 1.8; }

/* ===== 関連記事 ===== */
.related-posts { margin-top: 48px; }
.related-posts > h2 { font-size: 19px; margin-bottom: 4px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); }
.related-posts .post-grid { grid-template-columns: repeat(2, 1fr); margin: 20px 0 0; }
@media (max-width: 600px) { .related-posts .post-grid { grid-template-columns: 1fr; } }

/* ===== アーカイブ ===== */
.archive-header { margin: 36px 0 0; }
.archive-header h1 { font-size: 24px; }
.archive-header .desc { font-size: 14px; color: var(--text-light); margin-top: 6px; }

/* ===== ページネーション ===== */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 0 0 56px; flex-wrap: wrap; }
.pagination .page-numbers {
  display: inline-block; min-width: 40px; text-align: center; padding: 8px 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px; text-decoration: none;
}
.pagination .page-numbers.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a.page-numbers:hover { border-color: var(--accent); color: var(--accent); }

/* ===== フッター ===== */
.site-footer {
  background: var(--accent-dark); color: rgba(255, 255, 255, .85);
  padding: 32px 0; margin-top: 40px; font-size: 13px;
}
.site-footer a { color: #fff; }
.site-footer .footer-nav { list-style: none; display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }

/* ===== 404 / 検索 ===== */
.not-found { text-align: center; padding: 80px 20px; }
.not-found h1 { font-size: 26px; margin-bottom: 12px; }
.search-form-inline { display: flex; gap: 8px; max-width: 420px; margin: 20px auto 0; }
.search-form-inline input[type="search"] {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px;
}
.search-form-inline button {
  padding: 10px 20px; background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  font-size: 14px; font-weight: 700; cursor: pointer;
}

/* ===== 固定ページ ===== */
.page-main { max-width: 760px; margin: 0 auto; padding: 36px 20px 60px; }

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px); position: absolute !important;
  height: 1px; width: 1px; overflow: hidden;
}
