/*
 * 神戸暮らし Layout Fix v1.2.0
 * 緊急修正：ページ全体が画面幅の一部に縮小される問題
 */

/* ===== 1. ブラウザ幅を基準に強制復帰 ===== */
html,
body {
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

body {
    overflow-x: hidden !important;
}

/* WordPress / Astra の最上位ラッパー */
#page,
.site,
.site-content,
#content,
.ast-site-content,
.ast-container,
#primary,
main.site-main,
.content-area {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

/* 管理バーも画面幅へ */
#wpadminbar {
    width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: auto !important;
    box-sizing: border-box !important;
}

/* ===== 2. 実コンテンツだけを中央1280pxに ===== */
.home .site-main,
.home #primary,
.home .content-area,
.home .entry-content {
    width: 100% !important;
    max-width: none !important;
}

.home .site-main > *,
.home #primary > *,
.home .content-area > *,
.home .entry-content > *,
.home .wp-block-group__inner-container {
    box-sizing: border-box !important;
}

/*
 * Astra標準コンテナ。
 * 外側は100%、中身のみ最大1280px。
 */
.home .ast-container {
    width: min(1280px, calc(100vw - 64px)) !important;
    max-width: 1280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* 独自コンテンツコンテナ */
.home .kobe-container,
.home .kobe-wrap,
.home .kobe-news-wrap,
.home .kobe-home-wrap,
.home .livingkobe-container,
.home .livingkobe-wrap {
    width: min(1280px, calc(100vw - 64px)) !important;
    max-width: 1280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* ===== 3. サイドバー由来の縮小を解除 ===== */
.home #primary {
    float: none !important;
    flex: 0 0 100% !important;
}

.home #secondary,
.home .widget-area {
    display: none !important;
}

/* ===== 4. 横幅を縮小する危険な指定を無効化 ===== */
.home #page,
.home .site,
.home .site-content,
.home main,
.home #content,
.home #primary {
    transform: none !important;
    zoom: 1 !important;
}

/* ===== 5. ニュースGrid ===== */
.home .kobe-news-grid,
.home .news-grid,
.home .latest-news-grid,
.home .kobe-article-grid {
    width: 100% !important;
    max-width: none !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 24px !important;
    box-sizing: border-box !important;
}

.home .kobe-news-card,
.home .news-card,
.home .article-card,
.home .post-card {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}

/* ===== 6. タブレット ===== */
@media (max-width: 1024px) {
    .home .ast-container,
    .home .kobe-container,
    .home .kobe-wrap,
    .home .kobe-news-wrap,
    .home .kobe-home-wrap,
    .home .livingkobe-container,
    .home .livingkobe-wrap {
        width: calc(100vw - 40px) !important;
    }

    .home .kobe-news-grid,
    .home .news-grid,
    .home .latest-news-grid,
    .home .kobe-article-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* ===== 7. スマホ ===== */
@media (max-width: 767px) {
    .home .ast-container,
    .home .kobe-container,
    .home .kobe-wrap,
    .home .kobe-news-wrap,
    .home .kobe-home-wrap,
    .home .livingkobe-container,
    .home .livingkobe-wrap {
        width: calc(100vw - 32px) !important;
    }

    .home .kobe-news-grid,
    .home .news-grid,
    .home .latest-news-grid,
    .home .kobe-article-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}
