/* =============================================================================
   Keiba Blog - main.css
   白黒シンプルデザイン
   ============================================================================= */

/* ===== CSS カスタムプロパティ ===== */
:root {
    --color-bg:          #ffffff;
    --color-bg-sub:      #f7f7f7;
    --color-bg-dark:     #1a1a1a;
    --color-text:        #1a1a1a;
    --color-text-muted:  #666666;
    --color-text-light:  #999999;
    --color-border:      #e0e0e0;
    --color-border-dark: #333333;
    --color-accent:      #000000;
    --color-white:       #ffffff;

    /* 的中タグカラー */
    --color-hit:         #1a7a3f;
    --color-hit-bg:      #e8f5ee;
    --color-miss:        #b91c1c;
    --color-miss-bg:     #fef2f2;
    --color-pending:     #92400e;
    --color-pending-bg:  #fffbeb;

    /* レイアウト */
    --max-width:         1160px;
    --content-width:     720px;
    --sidebar-width:     280px;
    --gap:               40px;

    /* フォント */
    --font-base:         'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'メイリオ', sans-serif;
    --font-size-base:    16px;
    --line-height:       1.8;

    /* 角丸・シャドウ */
    --radius:            4px;
    --radius-lg:         8px;
    --shadow-sm:         0 1px 3px rgba(0,0,0,.08);
    --shadow-md:         0 4px 12px rgba(0,0,0,.10);
    --transition:        0.2s ease;
}

/* ===== リセット & ベース ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-base);
    font-size: 1rem;
    line-height: var(--line-height);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.7; }
a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

ul, ol { list-style: none; }

/* ===== レイアウト ===== */
.site { min-height: 100vh; display: flex; flex-direction: column; }

.site-content {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 20px;
}

/* 2カラムレイアウト */
.wrap {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: var(--gap);
    align-items: start;
}

/* ===== ヘッダー ===== */
.site-header {
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-text);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 20px;
}

/* サイトタイトル */
.site-branding { flex-shrink: 0; }

.site-title-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--color-text);
    line-height: 1.2;
}

.site-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.site-description {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* ナビゲーション */
.main-navigation { display: flex; align-items: center; }

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

.nav-menu li { position: relative; }

.nav-menu a {
    display: block;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: border-color var(--transition);
}

.nav-menu a:hover,
.nav-menu .current-menu-item > a {
    opacity: 1;
    border-bottom-color: var(--color-accent);
}

/* ドロップダウン */
.nav-menu .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-top: 2px solid var(--color-accent);
    min-width: 200px;
    box-shadow: var(--shadow-md);
    z-index: 200;
}

.nav-menu li:hover > .sub-menu { display: block; }

.nav-menu .sub-menu a {
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    border-left: none;
    font-size: 0.8rem;
}

/* ハンバーガーボタン */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    transition: transform var(--transition), opacity var(--transition);
}

.menu-toggle.is-active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.menu-toggle.is-active .hamburger-line:nth-child(2) {
    opacity: 0;
}
.menu-toggle.is-active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ===== ヒーローセクション ===== */
.hero-section {
    background: var(--color-bg-dark);
    color: var(--color-white);
    padding: 72px 24px;
    margin-bottom: 48px;
    text-align: center;
}

.hero-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.hero-description {
    font-size: 1rem;
    color: #cccccc;
    margin-bottom: 28px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.hero-btn {
    display: inline-block;
    padding: 12px 32px;
    background: var(--color-white);
    color: var(--color-text);
    font-weight: 700;
    font-size: 0.9rem;
    border: 2px solid var(--color-white);
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition);
}

.hero-btn:hover {
    background: transparent;
    color: var(--color-white);
    opacity: 1;
}

/* ===== 的中実績カウンター ===== */
.stats-section {
    margin-bottom: 48px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.stats-inner {
    display: flex;
    align-items: stretch;
    background: var(--color-bg);
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    gap: 6px;
}

.stat-divider {
    width: 1px;
    background: var(--color-border);
    margin: 16px 0;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-hit     { color: var(--color-hit); }
.stat-miss    { color: var(--color-miss); }
.stat-rate    { color: var(--color-text); }
.stat-pending { color: var(--color-pending); }

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ===== セクションヘッダー ===== */
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-text);
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.section-more-link {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ===== 的中タグ (バッジ) ===== */
.result-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 2px;
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1.6;
}

.result-hit {
    background: var(--color-hit-bg);
    color: var(--color-hit);
    border: 1px solid currentColor;
}

.result-miss {
    background: var(--color-miss-bg);
    color: var(--color-miss);
    border: 1px solid currentColor;
}

.result-pending {
    background: var(--color-pending-bg);
    color: var(--color-pending);
    border: 1px solid currentColor;
}

/* カテゴリーバッジ */
.post-category-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--color-bg-sub);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}

.post-category-badge:hover {
    background: var(--color-text);
    color: var(--color-white);
    opacity: 1;
}

/* ===== 記事カードグリッド (トップページ) ===== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.post-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-bg);
    transition: box-shadow var(--transition), transform var(--transition);
}

.post-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-card-thumbnail img,
.post-card-thumbnail {
    display: block;
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: var(--color-bg-sub);
}

.post-card-no-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-sub);
    aspect-ratio: 16/9;
}

.no-thumbnail-icon { font-size: 2rem; }

.post-card-body { padding: 16px; }

.post-card-meta-top {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.post-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 8px;
}

.post-card-title a {
    color: var(--color-text);
}

.post-card-title a:hover { text-decoration: underline; opacity: 1; }

.post-card-excerpt {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-footer { border-top: 1px solid var(--color-border); padding-top: 10px; }

.post-date {
    font-size: 0.75rem;
    color: var(--color-text-light);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ===== カテゴリーグリッド ===== */
.categories-section { margin-top: 48px; }

.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-align: center;
    color: var(--color-text);
    transition: background var(--transition), color var(--transition);
    gap: 4px;
}

.category-card:hover {
    background: var(--color-text);
    color: var(--color-white);
    opacity: 1;
}

.category-name { font-size: 0.875rem; font-weight: 700; }
.category-count { font-size: 0.75rem; color: var(--color-text-muted); }
.category-card:hover .category-count { color: #ccc; }

/* ===== 記事リスト (アーカイブ・インデックス) ===== */
.posts-list { display: flex; flex-direction: column; gap: 1px; border-top: 1px solid var(--color-border); }

.post-list-item {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 20px;
    align-items: start;
    padding: 24px 0;
    border-bottom: 1px solid var(--color-border);
}

.post-list-thumbnail img,
.post-list-thumbnail {
    display: block;
    width: 180px;
    height: 112px;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--color-bg-sub);
    flex-shrink: 0;
}

.post-list-no-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 180px;
    height: 112px;
    background: var(--color-bg-sub);
    border-radius: var(--radius);
}

.post-meta-top {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.post-list-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 8px;
}

.post-list-title a { color: var(--color-text); }
.post-list-title a:hover { text-decoration: underline; opacity: 1; }

.post-list-excerpt {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== ページヘッダー ===== */
.page-header {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--color-text);
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.4;
}

.page-title span { color: var(--color-text-muted); }

/* アーカイブヘッダー */
.archive-header { margin-bottom: 24px; }
.archive-description { margin-top: 8px; font-size: 0.875rem; color: var(--color-text-muted); }

/* フィルターボタン */
.archive-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--color-bg-sub);
    border-radius: var(--radius);
}

.filter-label { font-size: 0.8rem; font-weight: 500; color: var(--color-text-muted); }

.filter-btn {
    display: inline-block;
    padding: 4px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    color: var(--color-text);
    background: var(--color-bg);
    transition: background var(--transition), color var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--color-text);
    color: var(--color-white);
    border-color: var(--color-text);
    opacity: 1;
}

.filter-hit.active  { background: var(--color-hit);  border-color: var(--color-hit); }
.filter-miss.active { background: var(--color-miss); border-color: var(--color-miss); }
.filter-pending.active { background: var(--color-pending); border-color: var(--color-pending); }

/* ===== 記事詳細 (single.php) ===== */
.single-post { max-width: 100%; }

.entry-header { margin-bottom: 28px; }

.entry-meta-top {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.entry-title {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 16px;
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.entry-meta svg { vertical-align: middle; }

.post-author { display: inline-flex; align-items: center; gap: 4px; }
.post-modified { color: var(--color-text-light); }

.entry-thumbnail {
    margin-bottom: 32px;
    border-radius: var(--radius);
    overflow: hidden;
}

.entry-thumbnail img { width: 100%; }

/* 記事本文スタイル */
.entry-content {
    font-size: 0.95rem;
    line-height: 1.9;
    margin-bottom: 40px;
}

.entry-content h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 2em 0 0.8em;
    padding: 10px 16px;
    background: var(--color-bg-sub);
    border-left: 4px solid var(--color-text);
}

.entry-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 1.8em 0 0.6em;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

.entry-content p { margin-bottom: 1.2em; }

.entry-content ul,
.entry-content ol {
    list-style: disc;
    margin: 1em 0 1.2em 1.5em;
}

.entry-content ol { list-style: decimal; }
.entry-content li { margin-bottom: 0.4em; }

.entry-content a {
    color: var(--color-text);
    text-decoration: underline;
}

.entry-content blockquote {
    margin: 1.5em 0;
    padding: 16px 20px;
    background: var(--color-bg-sub);
    border-left: 4px solid var(--color-border-dark);
    font-style: italic;
    color: var(--color-text-muted);
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.875rem;
}

.entry-content th,
.entry-content td {
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    text-align: left;
}

.entry-content th {
    background: var(--color-bg-sub);
    font-weight: 700;
}

.entry-content tr:nth-child(even) td { background: var(--color-bg-sub); }

.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1em 0;
}

/* 記事フッター */
.entry-footer { margin-top: 32px; }

.entry-footer-inner { display: flex; flex-direction: column; gap: 16px; }

/* 的中バナー (大きいバージョン) */
.result-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.result-banner-hit {
    background: var(--color-hit-bg);
    color: var(--color-hit);
    border: 2px solid var(--color-hit);
}

.result-banner-miss {
    background: var(--color-miss-bg);
    color: var(--color-miss);
    border: 2px solid var(--color-miss);
}

.result-banner-pending {
    background: var(--color-pending-bg);
    color: var(--color-pending);
    border: 2px solid var(--color-pending);
}

/* タグ */
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tags-label { font-size: 0.8rem; color: var(--color-text-muted); }

.post-tag {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: 20px;
}

.post-tag:hover {
    background: var(--color-text);
    color: var(--color-white);
    border-color: var(--color-text);
    opacity: 1;
}

/* 前後記事ナビ */
.post-navigation {
    margin: 40px 0;
    padding: 24px 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.nav-previous a,
.nav-next a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: background var(--transition);
}

.nav-previous a:hover,
.nav-next a:hover {
    background: var(--color-bg-sub);
    opacity: 1;
}

.nav-next a { text-align: right; }

.nav-label {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.nav-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.4;
}

/* 関連記事 */
.related-posts { margin-top: 40px; }

.related-posts-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-text);
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.related-post-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.related-post-card:hover { box-shadow: var(--shadow-sm); }

.related-post-thumbnail img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }

.related-post-body { padding: 12px; }

.related-post-title {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 6px;
}

.related-post-title a { color: var(--color-text); }

/* ===== ページネーション ===== */
.pagination { margin-top: 40px; display: flex; justify-content: center; }

.pagination .page-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination .page-numbers li { display: inline-block; }

.pagination .page-numbers a,
.pagination .page-numbers span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition);
}

.pagination .page-numbers a:hover {
    background: var(--color-text);
    color: var(--color-white);
    border-color: var(--color-text);
    opacity: 1;
}

.pagination .page-numbers .current {
    background: var(--color-text);
    color: var(--color-white);
    border-color: var(--color-text);
}

/* ===== サイドバー ===== */
.widget-area {
    position: sticky;
    top: 84px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.widget {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.widget-title {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-text);
}

.widget-title span { display: block; }

/* 検索フォーム */
.widget_search .search-form { display: flex; gap: 4px; }

.search-field {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    outline: none;
    font-family: var(--font-base);
}

.search-field:focus { border-color: var(--color-text); }

.search-submit {
    padding: 8px 14px;
    background: var(--color-text);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: var(--font-base);
    transition: opacity var(--transition);
}

.search-submit:hover { opacity: 0.8; }

/* 最新記事ウィジェット */
.widget_recent_entries ul li {
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.82rem;
    line-height: 1.4;
}

.widget_recent_entries ul li:last-child { border-bottom: none; }
.widget_recent_entries ul li a { color: var(--color-text); }
.widget_recent_entries ul li a:hover { text-decoration: underline; opacity: 1; }

/* カテゴリーウィジェット */
.widget_categories ul li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.85rem;
}

.widget_categories ul li:last-child { border-bottom: none; }
.widget_categories ul li a { color: var(--color-text); }
.widget_categories ul li a:hover { text-decoration: underline; opacity: 1; }

.cat-count {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-left: 4px;
}

/* 月別アーカイブ */
.widget_archive ul li {
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

.widget_archive ul li:last-child { border-bottom: none; }
.widget_archive ul li a { color: var(--color-text); }

/* ===== コンタクトフォーム ===== */
.contact-form-wrap { max-width: 600px; }

.contact-feedback {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 0.875rem;
    font-weight: 500;
}

.contact-feedback.success {
    background: var(--color-hit-bg);
    color: var(--color-hit);
    border: 1px solid var(--color-hit);
}

.contact-feedback.error {
    background: var(--color-miss-bg);
    color: var(--color-miss);
    border: 1px solid var(--color-miss);
}

.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.required {
    color: var(--color-miss);
    margin-left: 4px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-family: var(--font-base);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--color-text);
    box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}

.form-input.is-error,
.form-textarea.is-error {
    border-color: var(--color-miss);
}

.form-textarea { resize: vertical; min-height: 150px; }

.form-error {
    display: block;
    font-size: 0.75rem;
    color: var(--color-miss);
    margin-top: 4px;
    min-height: 18px;
}

/* ===== ボタン ===== */
.btn-primary {
    display: inline-block;
    padding: 12px 32px;
    background: var(--color-text);
    color: var(--color-white);
    font-size: 0.875rem;
    font-weight: 700;
    border: 2px solid var(--color-text);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-base);
    transition: background var(--transition), color var(--transition);
    text-align: center;
}

.btn-primary:hover {
    background: transparent;
    color: var(--color-text);
    opacity: 1;
}

.btn-submit { min-width: 160px; }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 404ページ ===== */
.error-404-inner {
    text-align: center;
    padding: 80px 20px;
}

.error-icon { font-size: 4rem; margin-bottom: 16px; }
.error-title { font-size: 5rem; font-weight: 700; line-height: 1; margin-bottom: 16px; }
.error-message { font-size: 1.2rem; font-weight: 500; margin-bottom: 8px; }
.error-description { font-size: 0.875rem; color: var(--color-text-muted); margin-bottom: 32px; }

/* ===== フッター ===== */
.site-footer {
    border-top: 2px solid var(--color-text);
    margin-top: 40px;
}

.footer-widgets-area { background: var(--color-bg-sub); padding: 40px 20px; }

.footer-widgets-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.footer-widget { }
.footer-widget-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; }

.footer-bottom {
    background: var(--color-bg-dark);
    color: var(--color-white);
    padding: 20px;
}

.footer-bottom-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-nav-menu {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
}

.footer-nav-menu li a {
    display: block;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: #aaaaaa;
    border-right: 1px solid #444444;
}

.footer-nav-menu li:last-child a { border-right: none; }

.footer-nav-menu li a:hover { color: var(--color-white); opacity: 1; }

.copyright { font-size: 0.75rem; color: #888888; }
.copyright a { color: #aaaaaa; }

/* ===== プライバシーポリシー ===== */
.privacy-page .entry-header { margin-bottom: 32px; }
.privacy-updated { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 8px; }

.privacy-content h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 2em 0 0.8em;
    padding: 10px 16px;
    background: var(--color-bg-sub);
    border-left: 4px solid var(--color-text);
}

.privacy-content h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 1.5em 0 0.6em;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

.privacy-content p { margin-bottom: 1em; font-size: 0.9rem; line-height: 1.8; }

/* ===== 検索結果 ===== */
.search-count { font-size: 0.875rem; color: var(--color-text-muted); margin-bottom: 16px; }

/* ===== メッセージ ===== */
.no-posts { color: var(--color-text-muted); padding: 40px 0; text-align: center; }
.no-posts-message { padding: 40px 0; text-align: center; color: var(--color-text-muted); }

/* ===== スクロールトップボタン ===== */
#scroll-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    background: var(--color-text);
    color: var(--color-white);
    border: none;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition);
    z-index: 50;
    line-height: 1;
}

#scroll-top.is-visible {
    opacity: 1;
    pointer-events: auto;
}

#scroll-top:hover { transform: translateY(-3px); }

/* ===== レスポンシブ ===== */
@media (max-width: 900px) {
    .wrap {
        grid-template-columns: 1fr;
    }

    .widget-area {
        position: static;
        border-top: 2px solid var(--color-border);
        padding-top: 32px;
    }

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

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-widgets-inner {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    :root {
        --font-size-base: 15px;
    }

    .site-content { padding: 24px 16px; }

    .header-inner { height: 56px; }

    /* モバイルメニュー */
    .menu-toggle { display: flex; }

    .main-navigation {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--color-bg);
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow-md);
        z-index: 90;
        padding: 16px;
    }

    .main-navigation.is-open { display: flex; flex-direction: column; }

    .nav-menu { flex-direction: column; align-items: stretch; width: 100%; }
    .nav-menu a { padding: 12px 8px; border-bottom: 1px solid var(--color-border); border-left: none; }
    .nav-menu .sub-menu { position: static; box-shadow: none; border: none; border-top: none; background: var(--color-bg-sub); display: block; }

    .hero-section { padding: 48px 16px; }

    .stats-inner { flex-wrap: wrap; }
    .stat-item { min-width: 50%; }
    .stat-divider { display: none; }

    .post-list-item {
        grid-template-columns: 120px 1fr;
        gap: 12px;
    }

    .post-list-thumbnail,
    .post-list-no-thumbnail {
        width: 120px;
        height: 75px;
    }

    .nav-links { grid-template-columns: 1fr; }
    .nav-next a { text-align: left; }

    .related-posts-grid { grid-template-columns: 1fr; }

    .categories-grid { grid-template-columns: repeat(2, 1fr); }

    .footer-bottom-inner { flex-direction: column; text-align: center; }
    .footer-nav-menu { justify-content: center; }

    .footer-widgets-inner { grid-template-columns: 1fr; }

    #scroll-top { bottom: 16px; right: 16px; }
}

@media (max-width: 400px) {
    .post-list-item {
        grid-template-columns: 1fr;
    }
    .post-list-thumbnail,
    .post-list-no-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }
}
