/* =========================================
   まちナーレ フロントページ専用CSS
   ========================================= */

/* コンテナ・レイアウト・サイドバーは site.css で定義 */

/* ヒーローヘッダーの高さ・中央寄せは全ページ共通になったため site.css へ
   移した（元はトップ専用だった）。 */

/* セクション */
.machi-section {
    margin-top: 48px;
}

/* 最初のセクションは CTA バンド直下なので上余白なし */
.machi-main > .machi-section:first-child {
    margin-top: 0;
}

/* 「読んでおきたいテーマ」セクション：中の一覧（.machi-related、記事下と
   共通の部品）が持つ margin-top:48px は、記事下で単独使用するときに
   前のブロックとの間隔を作るためのもの。ここでは見出し（.machi-section-head）
   の直後に来るため、その分を打ち消して見出しとの間隔を他セクションと揃える
   （元は見出しが上のセクションに10pxしか離れず張り付き、逆に自分の一覧とは
   48px も離れて見える状態だった。2026-09-28）。 */
.machi-section .machi-related {
    margin-top: 0;
}

.machi-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 16px;
}

.machi-section-head h2 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--machi-main-dark);
}

/* グリッド */
.machi-grid {
    display: grid;
    gap: 16px;
}

.machi-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 860px) {
    .machi-grid-3 {
        grid-template-columns: 1fr;
    }

    /* 最初のセクションは CTA バンド直下なので上余白なし（PC・スマホ共通） */
    .machi-main > .machi-section:first-child {
        margin-top: 0;
    }

    /* containerの左右paddingが0になるため、端に密着する要素に僅かな余白 */
    .machi-section-head {
        padding: 0 10px;
    }
}

/* カード共通 */
.machi-card {
    background: var(--machi-card);
    border: 1px solid var(--machi-border);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    color: var(--machi-text);
    display: block;
}

/* 質問カード */
.machi-question-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.machi-question-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.machi-meta {
    margin-bottom: 10px;
}

/* .machi-date-badge は site.css で定義 */

.machi-question-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.machi-q-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.machi-q-icon img {
    width: 32px;
    height: 32px;
    border-radius: 9px;
}

.machi-question-head h3 {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.45;
    font-weight: 700;
}

.machi-card-excerpt {
    margin: 0;
    color: var(--machi-muted);
    font-size: 1rem;
    line-height: 1.6;
}

/* ランキングカード */
.machi-ranking-card {
    padding: 0;
}

.machi-ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.machi-ranking-list li {
    display: flex;
    /* center だとタイトルが2行になったとき丸数字が行間に浮いてしまうため、
       常にタイトル1行目の高さに合わせる（2026-09-29）。 */
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--machi-border);
}

.machi-ranking-list li:last-child {
    border-bottom: none;
}

.machi-ranking-list li a {
    flex: 1;
    min-width: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--machi-text);
    text-decoration: none;
    line-height: 1.5;
}

.machi-ranking-list li a:hover {
    color: var(--machi-main);
}

.machi-rank {
    width: 22px;
    height: 22px;
    /* タイトル1行目の文字の高さと視覚的に合うよう、行の先頭からわずかに下げる。 */
    margin-top: 5px;
    border-radius: 999px;
    background: var(--machi-accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.688rem;
    flex-shrink: 0;
}

/* PV数：タイトルと競合しないキャプション表示・右端に寄せる */
.machi-pv {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--machi-muted);
}

/* 更新日時：カード下端のキャプション行 */
.machi-ranking-updated {
    margin: 0;
    padding: 10px 20px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--machi-muted);
    border-top: 1px solid var(--machi-border);
}

/* サイドバー内の「まちのスポンサーになりませんか？」バナー：
   本来の margin:1.5em 0（記事下用）だと、スマホでは1カラムに積まれる
   サイドバーの中で上下の余白が目立って空きすぎる（2026-09-28）。 */
.machi-sidebar .machi-sponsor-banner-link {
    margin: 0.5em 0;
}
