/*
Theme Name: AutoFeed Pro
Theme URI: https://example.com/autofeed-pro
Author: Sugar
Description: 自動コンテンツ収集型アフィリエイトサイト向けWordPressテーマ。モバイルファースト設計。
Version: 2.0.4
License: GNU General Public License v2 or later
Text Domain: autofeed-pro
Tags: blog, news, custom-header, custom-menu, featured-images, adsense
Requires at least: 5.9
Tested up to: 6.7
Requires PHP: 7.4
*/

/* =============================================
   DESIGN TOKENS
   ============================================= */
:root {
  --c-bg:         #f2f2f2;
  --c-surface:    #ffffff;
  --c-surface2:   #fafafa;
  --c-border:     #e8e8e8;
  --c-text:       #111111;
  --c-text2:      #444444;
  --c-text3:      #888888;
  --c-accent:     #e8461a;
  --c-accent2:    #c73a14;
  --c-accent-bg:  #fff3f0;
  --c-header:     #111111;
  --c-overlay:    rgba(0,0,0,0.45);

  --font: 'M PLUS 2', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;

  --max-w:      1080px;
  --sidebar-w:  280px;
  --r:          10px;
  --r-sm:       6px;
  --r-xs:       4px;

  --sh-card:    0 1px 3px rgba(0,0,0,0.07), 0 4px 12px rgba(0,0,0,0.04);
  --sh-hover:   0 4px 16px rgba(0,0,0,0.11), 0 1px 4px rgba(0,0,0,0.05);

  --ease:       0.2s cubic-bezier(0.4,0,0.2,1);
  --ease-out:   0.3s cubic-bezier(0,0,0.2,1);
}

/* =============================================
   RESET
   ============================================= */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===横スクロール完全防止=== */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;          /* html自体も横スクロール禁止 */
  max-width: 100%;
}
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}
a { color: var(--c-accent); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--c-accent2); }
img { max-width: 100%; height: auto; display: block; }
ul,ol { list-style: none; }

/* =============================================
   HEADER
   ============================================= */
.site-header {
  background: var(--c-header);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 9999;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  width: 100%;
  max-width: 100%;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-sizing: border-box;
  width: 100%;
}

.site-branding { flex-shrink: 0; min-width: 0; }

.site-title-wrap { display: flex; flex-direction: column; }

.site-title {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.site-title a { color: #fff; }
.site-title a:hover { color: var(--c-accent); }

.site-tagline {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

.site-description { display: none; }

/* Nav */
.main-navigation { display: flex; align-items: center; flex-shrink: 0; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-menu li a {
  display: block;
  padding: 0.35rem 0.75rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--r-xs);
  transition: color var(--ease);
  white-space: nowrap;
}
.nav-menu li a:hover,
.nav-menu li.current-menu-item a { color: #fff; }

/* Hamburger */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.menu-toggle .bar {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: var(--ease);
}

/* Header Ad */
.header-ad {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 0.5rem 1rem;
  text-align: center;
  overflow: hidden;
}
/* AdSenseが表示されていない場合の空白を防ぐ */
.header-ad:empty,
.header-ad ins.adsbygoogle:not([data-ad-status="filled"]) {
  display: none;
}

/* =============================================
   CATEGORY TABS（トップページのカテゴリタブ）
   ============================================= */
.category-tabs-wrap {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 100%;
  overflow: hidden;     /* タブがはみ出ても外には影響しない */
}

.category-tabs {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }

.category-tab {
  flex-shrink: 0;
  display: block;
  padding: 0.7rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--c-text3) !important;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all var(--ease);
  cursor: pointer;
  text-decoration: none;
}
.category-tab:hover { color: var(--c-text) !important; }
.category-tab.active,
.category-tab:focus { color: var(--c-accent) !important; border-bottom-color: var(--c-accent); }

/* =============================================
   LAST UPDATED BAR
   ============================================= */
.last-updated-bar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.last-updated-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.4rem 1rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: var(--c-text3);
  font-weight: 500;
}

.last-updated-icon {
  display: flex;
  align-items: center;
  color: var(--c-accent);
  flex-shrink: 0;
}

.last-updated-label {
  color: var(--c-text3);
  flex-shrink: 0;
}

.last-updated-time {
  color: var(--c-text2);
  font-weight: 600;
}

.last-updated-ago {
  background: var(--c-accent-bg);
  color: var(--c-accent);
  font-weight: 700;
  font-size: 0.65rem;
  padding: 0.08rem 0.45rem;
  border-radius: 3px;
  flex-shrink: 0;
}

/* モバイル */
@media (max-width: 600px) {
  .last-updated-inner {
    padding: 0.35rem 0.875rem;
    font-size: 0.65rem;
    gap: 0.35rem;
  }
  .last-updated-time { font-size: 0.65rem; }
  .last-updated-ago  { font-size: 0.6rem; }
}

/* =============================================
   LAYOUT
   ============================================= */
.site-content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 1.25rem;
  align-items: start;
  box-sizing: border-box;
  width: 100%;
}

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

/* =============================================
   POSTS GRID — カード型（画像上・テキスト下）
   ============================================= */
.posts-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--c-surface);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--sh-card);
}

/* ---- 記事カード（横長リスト形式） ---- */
.post-card {
  display: grid;
  grid-template-columns: 90px 1fr;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: relative;
  z-index: 0;
  transition: background var(--ease);
  min-height: 0;
}
.post-card:last-child { border-bottom: none; }
.post-card:hover { background: #fafafa; }

/* 左アクセントライン */
.post-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--c-accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.25s ease;
  z-index: 1;
}
.post-card:hover::before { transform: scaleY(1); }

/* サムネイル */
.card-thumbnail {
  width: 90px;
  height: 70px;
  overflow: hidden;
  background: var(--c-bg);
  flex-shrink: 0;
  position: relative;
  margin: 0.5rem 0 0.5rem 0.5rem;
  border-radius: var(--r-sm);
}

.card-thumbnail a { display: block; width: 100%; height: 100%; }

.card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.post-card:hover .card-thumbnail img { transform: scale(1.06); }

.no-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
  color: #bbb;
  border-radius: var(--r-sm);
}

/* ソースバッジ（画像下に小さく） */
.card-source-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.75rem 0.25rem 0.2rem;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
}

.source-badge {
  display: inline-block;
  background: var(--c-accent);
  color: #fff;
  font-size: 0.52rem;
  font-weight: 800;
  padding: 0.06rem 0.3rem;
  border-radius: 2px;
  letter-spacing: 0.01em;
  line-height: 1.6;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* カード本文エリア */
.card-body {
  padding: 0.5rem 0.75rem 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.62rem;
  color: var(--c-text3);
  font-weight: 500;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.card-title a {
  color: var(--c-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-title a:hover { color: var(--c-accent); }

/* 抜粋・タグはデフォルト非表示 */
.card-excerpt { display: none; }
.card-tags { display: none; }

/* ---- フィーチャードカード（最初の1枚を大きく・縦型） ---- */
.post-card.is-featured {
  grid-template-columns: 1fr;
  flex-direction: column;
  display: flex;
  border-bottom: 1px solid var(--c-border);
}

.post-card.is-featured .card-thumbnail {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 7;
  margin: 0;
  border-radius: 0;
  position: relative;
}

.post-card.is-featured .card-source-overlay {
  padding: 2rem 0.75rem 0.5rem;
  border-radius: 0;
}

.post-card.is-featured .source-badge {
  font-size: 0.62rem;
  padding: 0.12rem 0.45rem;
}

.post-card.is-featured .card-body {
  padding: 0.75rem 1rem 0.875rem;
  gap: 0.3rem;
}

.post-card.is-featured .card-title {
  font-size: 1rem;
  -webkit-line-clamp: 2;
}

.post-card.is-featured .card-excerpt {
  display: -webkit-box;
  font-size: 0.78rem;
  color: var(--c-text2);
  line-height: 1.6;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card.is-featured .card-meta {
  font-size: 0.68rem;
}

/* ---- インフィード広告 ---- */
.in-feed-ad {
  grid-column: 1 / -1;
  background: var(--c-surface);
  border-radius: var(--r);
  padding: 1rem;
  text-align: center;
  position: relative;
  box-shadow: var(--sh-card);
}
.in-feed-ad::before {
  content: 'PR';
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  font-size: 0.55rem;
  color: var(--c-text3);
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.65rem;
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--c-text2);
  background: var(--c-surface);
  box-shadow: var(--sh-card);
  transition: all var(--ease);
}
.pagination .page-numbers:hover { color: var(--c-accent); box-shadow: var(--sh-hover); }
.pagination .page-numbers.current {
  background: var(--c-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232,70,26,0.35);
}

/* =============================================
   ARCHIVE HEADER
   ============================================= */
.archive-header {
  background: var(--c-surface);
  border-radius: var(--r);
  box-shadow: var(--sh-card);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--c-accent);
}
.archive-header h1 { font-size: 1.1rem; font-weight: 800; }
.archive-header .archive-description { font-size: 0.82rem; color: var(--c-text3); margin-top: 0.3rem; }

/* =============================================
   SINGLE POST
   ============================================= */
.single-post-content {
  background: var(--c-surface);
  border-radius: var(--r);
  box-shadow: var(--sh-card);
  overflow: hidden;
}

.single-post-header { padding: 1.25rem 1.25rem 0; }

.post-category {
  display: inline-block;
  background: var(--c-accent);
  color: #fff;
  padding: 0.18rem 0.65rem;
  border-radius: var(--r-xs);
  font-size: 0.68rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.single-post-header h1 {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.55;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.single-post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.75rem;
  color: var(--c-text3);
  font-weight: 500;
  flex-wrap: wrap;
}

.single-featured-image img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

/* 記事本文 */
.single-post-body {
  padding: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--c-text);
  overflow-wrap: break-word;
  word-break:    break-word;
  overflow-x:    hidden;
  min-width:     0;
}

.single-post-body img,
.single-post-body figure img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: var(--r-sm);
}

.single-post-body figure { margin: 1.25rem 0; }

.single-post-body iframe { max-width: 100% !important; }

.single-post-body .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.25rem 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
}

.single-post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.single-post-body th,
.single-post-body td {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--c-border);
  text-align: left;
}
.single-post-body th { background: var(--c-bg); font-weight: 700; }

.single-post-body pre,
.single-post-body code { font-family: monospace; font-size: 0.85em; }
.single-post-body pre {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: var(--r-sm);
  padding: 1rem;
  overflow-x: auto;
  margin: 1.25rem 0;
}
.single-post-body :not(pre) > code {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  color: var(--c-accent);
  font-size: 0.85em;
}

.single-post-body p { margin-bottom: 1.25rem; }

.single-post-body h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 2rem 0 0.75rem;
  padding: 0.6rem 0.875rem;
  background: var(--c-bg);
  border-left: 4px solid var(--c-accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.single-post-body h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.75rem 0 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--c-border);
}

.single-post-body ul,
.single-post-body ol { margin: 0.75rem 0 1.25rem 1.25rem; }
.single-post-body ul { list-style: disc; }
.single-post-body ol { list-style: decimal; }
.single-post-body li { margin-bottom: 0.35rem; }

.single-post-body blockquote {
  border-left: 4px solid var(--c-accent);
  padding: 0.875rem 1.25rem;
  margin: 1.25rem 0;
  background: var(--c-accent-bg);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-style: italic;
  color: var(--c-text2);
}

.single-post-body a { text-decoration: underline; text-underline-offset: 2px; }

/* 広告 */
.ad-before-content,
.ad-after-content,
.ad-in-content { margin: 1.25rem 0; text-align: center; }

/* ソースリンク */
.source-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.25rem;
  padding: 0.6rem 1rem;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-text2);
  transition: all var(--ease);
}
.source-link:hover { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }

/* タグエリア */
.single-post-tags { padding: 0 1.25rem 1.25rem; }

/* 関連記事 */
.related-posts {
  border-top: 1px solid var(--c-border);
  padding: 1.25rem;
}
.related-posts h3 {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-text3);
  margin-bottom: 1rem;
}
.related-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.65rem; }

.related-item {
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  transition: all var(--ease);
}
.related-item:hover { box-shadow: var(--sh-hover); transform: translateY(-2px); }

.related-thumb {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--c-bg);
}
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }

.related-info { padding: 0.5rem 0.6rem; }
.related-info h4 {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.related-info h4 a { color: var(--c-text); }
.related-info h4 a:hover { color: var(--c-accent); }

/* =============================================
   SIDEBAR
   ============================================= */
.site-sidebar { position: sticky; top: calc(52px + 1rem); }

.widget {
  background: var(--c-surface);
  border-radius: var(--r);
  box-shadow: var(--sh-card);
  padding: 1rem;
  margin-bottom: 1rem;
}

.widget-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-text3);
  margin-bottom: 0.875rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.widget-title::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 2.5px;
  background: var(--c-accent);
  border-radius: 2px;
  flex-shrink: 0;
}

/* 人気記事 */
.popular-posts-list .popular-item {
  display: flex;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--c-border);
}
.popular-posts-list .popular-item:last-child { border-bottom: none; padding-bottom: 0; }
.popular-posts-list .popular-item:first-child { padding-top: 0; }

.pop-rank {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  color: var(--c-text3);
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: var(--r-xs);
}
.pop-rank.rank-1 { background: #fef3c7; border-color: #f59e0b; color: #b45309; }
.pop-rank.rank-2 { background: #f1f5f9; border-color: #94a3b8; color: #475569; }
.pop-rank.rank-3 { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }

.pop-info h4 { font-size: 0.75rem; font-weight: 600; line-height: 1.5; }
.pop-info h4 a { color: var(--c-text); }
.pop-info h4 a:hover { color: var(--c-accent); }
.pop-date { font-size: 0.65rem; color: var(--c-text3); margin-top: 0.1rem; }

/* カテゴリ */
.category-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border-radius: var(--r-sm);
  color: var(--c-text2);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all var(--ease);
}
.category-list li a:hover { background: var(--c-accent-bg); color: var(--c-accent); padding-left: 0.75rem; }

.count {
  background: var(--c-bg);
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--c-text3);
  border: 1px solid var(--c-border);
}

/* タグクラウド */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag-cloud a {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--c-border);
  border-radius: 50px;
  font-size: 0.7rem;
  color: var(--c-text2);
  font-weight: 500;
  transition: all var(--ease);
}
.tag-cloud a:hover { border-color: var(--c-accent); color: var(--c-accent); background: var(--c-accent-bg); }

/* タグ（記事カード・詳細用） */
.tag {
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--c-border);
  border-radius: 50px;
  color: var(--c-text3);
  font-weight: 500;
  transition: all var(--ease);
}
.tag:hover { border-color: var(--c-accent); color: var(--c-accent); }

.card-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }

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

/* =============================================
   SEARCH FORM
   ============================================= */
.search-form { display: flex; }
.search-field {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--c-border);
  border-right: none;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  font-size: 0.82rem;
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  outline: none;
  transition: border-color var(--ease);
}
.search-field:focus { border-color: var(--c-accent); background: #fff; }
.search-submit {
  padding: 0.55rem 0.875rem;
  background: var(--c-accent);
  color: #fff;
  border: 1px solid var(--c-accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--ease);
}
.search-submit:hover { background: var(--c-accent2); }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  background: var(--c-header);
  color: rgba(255,255,255,0.7);
  margin-top: 2.5rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.footer-ad {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem 1rem 0;
  text-align: center;
}

.footer-widgets {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1rem 1.5rem;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.footer-widgets .widget { background: none; box-shadow: none; border: none; padding: 0; margin: 0; }
.footer-widgets .widget-title { color: #fff; border-bottom-color: rgba(255,255,255,0.1); }
.footer-widgets .widget-title::before { background: var(--c-accent); }

.footer-widgets a,
.footer-link-list li a,
.footer-menu-list li a { color: rgba(255,255,255,0.6); }
.footer-widgets a:hover,
.footer-link-list li a:hover,
.footer-menu-list li a:hover { color: var(--c-accent); }

.footer-widgets .category-list li a { color: rgba(255,255,255,0.6); background: none; font-size: 0.82rem; padding: 0.28rem 0; }
.footer-widgets .category-list li a:hover { background: none; color: var(--c-accent); padding-left: 0.35rem; }

.footer-link-list { list-style: none; }
.footer-link-list li a,
.footer-menu-list li a { display: block; padding: 0.28rem 0; font-size: 0.82rem; font-weight: 500; }

.footer-site-desc { font-size: 0.8rem; line-height: 1.8; color: rgba(255,255,255,0.42); margin-top: 0.5rem; }

.footer-sns { display: flex; gap: 0.65rem; margin-top: 1rem; }
.footer-sns a {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-xs);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.55);
  transition: all var(--ease);
}
.footer-sns a:hover { background: var(--c-accent); color: #fff; }

.footer-bottom {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem;
  text-align: center;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.32);
}

/* =============================================
   UTILITY
   ============================================= */
/* パンくず */
.breadcrumb {
  font-size: 0.72rem;
  color: var(--c-text3);
  padding: 0.5rem 0;
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--c-text3); }
.breadcrumb a:hover { color: var(--c-accent); }
.breadcrumb .sep { opacity: 0.4; }

/* ページ */
.page-content {
  background: var(--c-surface);
  border-radius: var(--r);
  box-shadow: var(--sh-card);
  padding: 1.5rem;
}
.page-content h1 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  padding-bottom: 0.875rem;
  border-bottom: 2px solid var(--c-border);
}

/* 404 */
.error-404-content {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--c-surface);
  border-radius: var(--r);
  box-shadow: var(--sh-card);
}
.error-404-content .error-code {
  font-size: 5rem;
  font-weight: 900;
  color: var(--c-accent);
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
}
.error-404-content h1 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.65rem; }
.error-404-content p { color: var(--c-text3); margin-bottom: 1.5rem; }

.btn-home {
  display: inline-block;
  padding: 0.65rem 1.75rem;
  background: var(--c-accent);
  color: #fff;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 0.875rem;
  transition: background var(--ease);
}
.btn-home:hover { background: var(--c-accent2); color: #fff; }

/* スクロールトップ */
.scroll-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  background: var(--c-accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--ease);
  box-shadow: 0 4px 16px rgba(232,70,26,0.35);
  z-index: 999;
  font-weight: 700;
}
.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { background: var(--c-accent2); transform: translateY(-3px); }

/* アドミンバー */
.admin-bar .site-header { top: 32px; }

@media screen and (max-width: 782px) {
  .admin-bar .site-header { top: 46px; }
  
}

/* フェードインアニメ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.post-card {
  animation: fadeUp 0.35s ease both;
}
.posts-grid .post-card:nth-child(2)  { animation-delay: 0.04s; }
.posts-grid .post-card:nth-child(3)  { animation-delay: 0.08s; }
.posts-grid .post-card:nth-child(4)  { animation-delay: 0.12s; }
.posts-grid .post-card:nth-child(5)  { animation-delay: 0.16s; }
.posts-grid .post-card:nth-child(6)  { animation-delay: 0.20s; }

/* =============================================
   RESPONSIVE — TABLET (max-width: 900px)
   ============================================= */
@media (max-width: 900px) {
  .site-content { grid-template-columns: 1fr; }
  .site-sidebar { position: static; top: auto; }
  .posts-grid { flex-direction: column; }
  .footer-widgets { grid-template-columns: 1fr 1fr; }
  .related-grid { grid-template-columns: repeat(2,1fr); }
}

/* =============================================
   RESPONSIVE — MOBILE (max-width: 600px)
   ============================================= */
@media (max-width: 600px) {
  html { font-size: 15px; }

  /* ヘッダー */
  .header-inner { padding: 0 0.875rem; height: 48px; }
  .site-title { font-size: 0.95rem; max-width: 170px; }
  .menu-toggle { display: flex; }
  .nav-menu {
    display: none;
    position: fixed;        /* absoluteからfixedに変更でviewport基準になりはみ出しが起きない */
    top: 48px; left: 0;
    width: 100%;            /* 100vwではなく100%で親に収まる */
    max-width: 100%;
    background: #1a1a1a;
    flex-direction: column;
    padding: 0.5rem;
    z-index: 9998;
    border-top: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    box-sizing: border-box;
  }
  .nav-menu.active { display: flex; }
  .nav-menu li a { padding: 0.65rem 0.875rem; font-size: 0.875rem; color: rgba(255,255,255,0.8); }
  .admin-bar .nav-menu { top: calc(48px + 46px); }

  /* カテゴリタブ */
  .category-tabs-wrap { top: 48px; }
  .category-tab { padding: 0.6rem 0.875rem; font-size: 0.75rem; }

  /* コンテンツ */
  .site-content { padding: 0.75rem; gap: 1rem; }

  /* 横長リスト — スマホでもリスト形式を維持 */
  .posts-grid {
    border-radius: var(--r-sm);
    gap: 0;
  }

  /* カード */
  .post-card { grid-template-columns: 80px 1fr; }
  .post-card::before { width: 2px; }
  .card-thumbnail {
    width: 80px;
    height: 62px;
    margin: 0.45rem 0 0.45rem 0.45rem;
  }
  .card-body { padding: 0.45rem 0.65rem 0.45rem 0.45rem; gap: 0.15rem; }
  .card-meta { font-size: 0.6rem; gap: 0.25rem; }
  .card-title { font-size: 0.75rem; line-height: 1.42; -webkit-line-clamp: 2; }
  .source-badge { font-size: 0.5rem; padding: 0.05rem 0.28rem; }

  /* フィーチャードカード */
  .post-card.is-featured { display: flex; flex-direction: column; }
  .post-card.is-featured .card-thumbnail {
    width: 100%; height: auto; margin: 0;
    border-radius: 0; aspect-ratio: 16/7;
  }
  .post-card.is-featured .card-body { padding: 0.65rem 0.875rem 0.75rem; gap: 0.25rem; }
  .post-card.is-featured .card-title { font-size: 0.9rem; }
  .post-card.is-featured .card-excerpt { font-size: 0.72rem; -webkit-line-clamp: 2; }

  /* 記事詳細 */
  .single-post-header { padding: 1rem 1rem 0; }
  .single-post-header h1 { font-size: 1.1rem; }
  .single-post-meta { font-size: 0.72rem; gap: 0.6rem; }
  .single-post-body { padding: 1rem; font-size: 0.9rem; }
  .single-post-body h2 { font-size: 1rem; }
  .single-post-body h3 { font-size: 0.95rem; }
  .related-posts { padding: 1rem; }
  .related-grid { grid-template-columns: repeat(2,1fr); gap: 0.5rem; }
  .single-post-tags { padding: 0 1rem 1rem; }

  /* サイドバー */
  .widget { padding: 0.875rem; border-radius: var(--r-sm); }

  /* フッター */
  .footer-widgets { grid-template-columns: 1fr; padding: 1.5rem 1rem 1.25rem; gap: 1.25rem; }
  .footer-ad { padding: 1rem 1rem 0; }
  .footer-bottom { padding: 0.875rem 1rem; }

  /* ページネーション */
  .pagination { gap: 0.25rem; }
  .pagination .page-numbers { min-width: 34px; height: 34px; font-size: 0.75rem; }

  /* アーカイブ */
  .archive-header { padding: 0.875rem 1rem; border-radius: var(--r-sm); margin-bottom: 0.75rem; }
  .archive-header h1 { font-size: 1rem; }

  /* ページ */
  .page-content { padding: 1rem; border-radius: var(--r-sm); }

  /* スクロールトップ */
  .scroll-top { bottom: 1rem; right: 0.75rem; width: 36px; height: 36px; font-size: 0.85rem; }
}

/* =============================================
   PRINT
   ============================================= */
@media print {
  .site-header, .site-sidebar, .site-footer,
  .scroll-top, .category-tabs-wrap,
  .ad-before-content, .ad-after-content, .ad-in-content,
  .header-ad, .in-feed-ad, .sidebar-ad, .footer-ad { display: none !important; }
  .site-content { display: block; }
  body { font-size: 12pt; color: #000; background: #fff; }
}
