/* --- 1. Modern Reset & Variables --- */
:root {
  --bg-main: #f8fafc;
  --header-dark: #121212;
  --accent: #3b82f6; /* 洗練されたブルー */
  --text-main: #1e293b;
  --text-muted: #64748b;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --featured-bg: #f0f7ff;
}

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

body {
  font-family: "Inter", "Hiragino Sans", "Segoe UI", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
ul { list-style: none; }

/* --- 2. Site Header (Dark & Elegant) --- */
.site-header {
  background-color: var(--header-dark);
  padding: 2.5rem 0 1.5rem;
  position: relative;
  overflow: hidden;
}

/* 以前のこだわり：1pxのグラデーション境界線 */
.site-header::after {
  content: "";
  position: absolute;
  bottom: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #333, transparent);
}

.header-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
}

.site-title {
  display: inline-block;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  background: linear-gradient(to bottom, #fff, #ccc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.nav-btn {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.nav-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.ad-notice { font-size: 0.7rem; color: #fff; letter-spacing: 0.05em; }

/* --- 3. Main Content Layout --- */
.main-content { padding: 40px 0; }
.content-container { max-width: 800px; margin: 0 auto; padding: 0 20px; }

/* --- 4. Page Header (左揃えの極致) --- */
.page-header-area {
  margin-bottom: 2rem;
  padding-left: 4px; /* アイコンとの微調整 */
}

.page-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.icon-theme { font-size: 1.4rem; color: var(--accent); }
.main-page-title { font-size: 1.5rem; font-weight: 800; color: #0f172a; }
.page-subtext { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }

/* --- 5. Article Card --- */
.article-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #fafafa;
  border-bottom: 1px solid var(--border-color);
}

.header-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.refresh-button {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; transition: transform 0.5s ease;
}
.refresh-button:hover { transform: rotate(180deg); color: var(--accent); }

/* --- 6. Antenna List & Items --- */
.antenna-item {
  border-bottom: 1px solid var(--border-color);
}
.antenna-item:last-child { border-bottom: none; }

.article-link {
  display: block;
  padding: 1.25rem;
  position: relative;
}

.article-link:hover { background-color: #f8fafc; }

.article-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.article-link:hover .article-title { color: var(--accent); }

.article-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meta-left { display: flex; align-items: center; gap: 12px; }

.site-tag {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}

.post-date { font-size: 0.75rem; color: #94a3b8; font-weight: 500; }

.arrow-icon { color: #cbd5e1; font-size: 0.8rem; transform: translateX(0); transition: 0.2s; }
.article-link:hover .arrow-icon { transform: translateX(4px); color: var(--accent); }

.is-featured {
  background: var(--featured-bg);
  border-left: 4px solid var(--accent);
}

/* --- 7. Pager (Pagination) --- */
/* --- Pagination (横一列に統合) --- */
.pager-container {
  margin-top: 3rem;
  display: flex;
  justify-content: center;
}

.pager-list {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  flex-wrap: wrap; /* スマホで入り切らない場合に折り返し */
  justify-content: center;
}

.pager-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

/* 先頭・最後ボタンの個別調整（文字が入るので幅を広く） */
.pager-side {
  width: auto;
  padding: 0 12px;
  font-size: 0.8rem;
}

.pager-num:not(.is-current):not(.is-disabled):hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f0f7ff;
}

.pager-num.is-current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.pager-num.is-disabled {
  background: #f1f5f9;
  color: #cbd5e1;
  cursor: not-allowed;
}

/* ページネーションのボタンが縦にならないようにする */
.pager-num.pager-side {
    white-space: nowrap; /* 文字を折り返さない */
    display: inline-flex; /* 中の文字を中央に寄せやすくする */
    align-items: center;
    justify-content: center;
    min-width: 4em;      /* 必要に応じて最低限の幅を確保 */
}

/* スマホ対応：さらに指で押しやすく */
@media (max-width: 480px) {
  .pager-list {
    gap: 4px;
  }
  .pager-num {
    width: 36px;
    height: 36px;
  }
  .pager-side {
    padding: 0 8px;
  }
}



/* --- 8. Footer --- */
.site-footer { padding: 4rem 0; background: #fff; border-top: 1px solid var(--border-color); text-align: center; }
.footer-info { font-size: 0.8rem; color: var(--text-muted); margin: 1.5rem auto; max-width: 600px; }
.footer-links a { margin: 0 10px; font-size: 0.85rem; color: var(--text-main); font-weight: 600; }
.footer-copyright { margin-top: 2rem; font-size: 0.75rem; color: #94a3b8; }

/* --- Responsive --- */
@media (max-width: 640px) {
  .main-page-title { font-size: 1.25rem; }
  .article-title { font-size: 1rem; }
  .arrow-icon { display: none; }
}

/* --- Popularity Specific --- */

/* ランキングレイアウト */
.popularity-container {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.article-content {
  flex: 1;
}

/* 順位バッジの基本スタイル */
.rank-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: 6px;
  margin-top: 2px;
}

/* 1位〜3位のカラー演出（クールな配色） */
.rank-item-1 .rank-badge { background: #fbbf24; color: #fff; } /* ゴールド */
.rank-item-2 .rank-badge { background: #94a3b8; color: #fff; } /* シルバー */
.rank-item-3 .rank-badge { background: #cd7f32; color: #fff; } /* ブロンズ（銅） */

/* 1位の記事タイトルを少しだけ強調 */
.rank-item-1 .article-title {
  color: #0f172a;
}

/* スマホでの調整 */
@media (max-width: 480px) {
  .popularity-container {
    gap: 10px;
  }
  .rank-badge {
    min-width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }
}


/* --- Site Specific (Grouped List) --- */

.site-section-header {
  background-color: #f1f5f9; /* 薄いグレーの帯 */
  padding: 10px 15px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  /* 2つ目以降のサイト見出しの上に少し隙間を作る */
  margin-top: 0; 
}

/* 最初のサイト見出し以外は、上に境界線やマージンを調整 */
.site-section-header:not(:first-child) {
  border-top: 2px solid var(--border-color);
}

.site-section-header i {
  color: var(--accent);
  font-size: 0.7rem;
}

/* サイト別リスト内の余白微調整 */
.site-section-header + .antenna-item .article-link {
  padding-top: 15px;
}

/* 広告エリア共通設定 */
.ad-area {
    margin: 20px auto;
    text-align: center;
    overflow: hidden; /* スマホではみ出し防止 */
}

.ad-top {
    margin-top: 10px;
    margin-bottom: 25px;
}

.ad-bottom {
    margin-top: 30px;
    margin-bottom: 20px;
}

/* 広告内のラベル（「スポンサーリンク」など） */
.ad-placeholder p {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

/* 実際のバナー画像やiframeを中央に寄せる */
.ad-area ins, 
.ad-area iframe {
    margin: 0 auto !important;
    display: block !important;
    max-width: 100% !important; /* 横幅を親要素に合わせる */
}

/* PC向け：画面幅が1200px以上の時だけ表示 */
@media (min-width: 1200px) {
    .site-layout-wrapper {
        display: flex;
        /* 両端に広告、真ん中にメイン。余ったスペースを等分する */
        justify-content: space-between; 
        align-items: flex-start;
        /* 全体の最大幅を決める（例：1400pxにすると、1400px以上は離れない） */
        max-width: 1500px; 
        margin: 0 auto;
        padding-left: 17px; 
    }

    .side-ad {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 160px;
        position: sticky;
        margin-top: 400px;
        top: 50px;
        flex-shrink: 0;
        /* ★ここ：外側の余白を自動計算。これで「サイドエリアの真ん中」に居座る */
        margin-left: auto;
        margin-right: auto;
    }

    .main-content {
        flex-basis: 800px;
        width: 800px;
        flex-grow: 0;
        flex-shrink: 0;
        padding: 40px 0;
        
        /* ★重要：最小限確保したい距離（例：50px）だけをマージンで設定 */
        /* それ以上の距離は side-ad の auto margin が自動で広げてくれる */
        margin-left: 50px !important;
        margin-right: 50px !important;
    }

    /* 広告タグ自体のセンター寄せ（これは維持） */
    .side-ad ins, .side-ad iframe, .side-ad .ad-placeholder {
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
    }
}

/* スマホ・タブレット向け：広告エリアを存在ごと消す */
@media (max-width: 1199px) {
    .side-ad {
        display: none;
    }
}

/* --- 9. Info Page Specific --- */
.page-content-area {
    margin-bottom: 2rem;
}

.page-text-body {
    padding: 2rem;
}

.info-section {
    margin-bottom: 3rem;
}

.info-section h2 {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 3rem 0;
}

.policy-item {
    margin-bottom: 1.5rem;
}

.policy-item h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.policy-item p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.contact-link-wrapper {
    margin: 2rem 0;
}