.wp-site-blocks {
    display: flex;
    height: 100vh; /* 容器高度为视口高度 */
}

body main.is-layout-flex {
    flex-grow: 1;     /* 关键：右侧主区域占据所有剩余宽度，实现自动铺满 */
    overflow: hidden; /* 隐藏 .main 自身的溢出，滚动由 .main-default-content 处理 */
    display: flex;    /* 使 .main-default-content 的 height: 100% 能正确基于 .main 的高度 */
    padding-bottom: 0 !important;
}


body.fixed-menu-position.page-template-horizontal main.is-layout-flex, body.fixed-menu-position.post-template-horizontal main.is-layout-flex {
	overflow: hidden;
}

body.single main.is-layout-flex {
	overflow: auto;
}
body.page-template-horizontal main.is-layout-flex, body.post-template-horizontal main.is-layout-flex {
    overflow: inherit !important;
}
.main-default-content {
    height: 100%;     /* 高度撑满 .main (即视口高度) */
    box-sizing: border-box;
    padding: 20px 400px 20px 20px; /* 右侧留出100px的空间 */
    overflow-y: hidden;   /* 内容是横向展开的，所以垂直方向不应该滚动 */
    overflow-x: hidden;     /* 当【所有列的总宽度】超过容器时，允许横向滚动 */
    flex: 1;
}

body.fixed-menu-position.page-template-horizontal .main-default-content, body.fixed-menu-position.post-template-horizontal .main-default-content {
    overflow-x: auto;
}
.main-default-content .entry-content {
    height: calc(100% - 50px);
    box-sizing: border-box;
    padding: 20px 20px 20px 0;
    margin-left: 0;
	margin-right: 0;

    /* --- 核心：CSS Columns --- */
    column-width: 300px;  /* 【每一列】的固定宽度 */
    column-gap: 20px;     /* 列之间的间隙 */
    /* column-fill: auto; */ /* 内容会先填满一列再到下一列 */

    overflow-y: hidden;   /* 内容是横向展开的，所以垂直方向不应该滚动 */
    overflow-x: auto;     /* 当【所有列的总宽度】超过容器时，允许横向滚动 */
}

body.page-template-horizontal .main-default-content .entry-content {
    display: flex;
}

.wp-block-gallery.has-nested-images figure.wp-block-image {
    justify-content: flex-start;
}

.main-default-content .entry-content figure.wp-block-gallery.has-nested-images {
	flex-direction: row;
	flex-wrap: nowrap;
	margin:0 !important;
}

body.fixed-menu-position.page-template-horizontal .main-default-content .entry-content, body.fixed-menu-position.post-template-horizontal .main-default-content .entry-content {
    overflow-x: auto;
}

.main-default-content > h1 {
    margin-left: 0 !important;
}

/* 针对图片块 (figure元素) */
.main-default-content .entry-content .wp-block-image { /* 增加选择器特异性 */
    height: 100%;                 /* ⭐ figure 高度为视口高度 */
    width: 100%;                   /* figure 宽度占满其父容器 (.entry-content) */
    margin: 0 !important;                     /* 移除 figure 默认的 margin */
    padding: 0;                    /* 移除 figure 可能有的 padding */
    display: inline-flex;                 /* 使用 flex 布局来居中图片 */
    justify-content: center;       /* 水平居中图片 */
    align-items: center;         /* 垂直居中图片 */
    overflow: hidden;              /* 隐藏figure内部溢出的内容 (虽然object-fit应处理img) */
    box-sizing: border-box;        /* 确保padding和border不增加总尺寸 */
    position: relative;            /* 为子元素 (如图片) 提供相对定位 */
    align-items: baseline;
}

/* 针对图片本身 (img元素) */
.main-default-content .entry-content .wp-block-image img, /* 这是一个示例，针对具体图片ID */
.main-default-content .entry-content .wp-block-image img[class*="wp-image-"] { /* 更通用的选择器，针对所有 wp-image-xxxx 类的图片 */
    display: block; /* 消除图片下方的空白间隙 */

    /* --- 核心样式 --- */
    object-fit: contain !important; /* ⭐⭐ 关键: 强制 contain，确保图片完整显示并保持比例 */
    height: auto !important;        /* ⭐⭐ 关键: 强制图片高度充满其父容器 (figure) */
    width: auto !important;         /* ⭐⭐ 关键: 强制图片宽度自适应以保持宽高比 */

    /* --- 约束和重置 --- */
    max-width: 100%;     /* 图片宽度不超过其父容器 (figure) 的宽度 */
    max-height: 100%;    /* 图片高度不超过其父容器 (figure) 的高度 (理论上 height:100% 已实现) */

    /* 尝试覆盖WordPress可能通过JS或CSS设置的固定尺寸 */
    min-width: 0;        /* 重置最小宽度 */
    min-height: 0;       /* 重置最小高度 */

    /* 确保HTML属性不会干扰CSS的auto计算。CSS属性通常优先，但这是双重保险。 */
    /* 对于现代浏览器，CSS的 width/height 属性会覆盖HTML的 width/height 属性。*/
    /* object-fit 作用于由CSS width/height定义的框。 */
    flex: unset !important;
}
/*
  针对 .main-default-content 的直接子元素，
  尝试避免它们在列中间被不优雅地分割。
  根据动态内容生成的标签调整此列表。
*/
.main-default-content > p,
.main-default-content > h1,
.main-default-content > h2,
.main-default-content > h3,
.main-default-content > h4,
.main-default-content > h5,
.main-default-content > h6,
.main-default-content > ul,
.main-default-content > ol,
.main-default-content > li,
.main-default-content > figure,
.main-default-content > blockquote,
.main-default-content > div, /* 如果动态内容包含未指定class的div作为内容块 */
.main-default-content > img, /* 如果图片本身是顶级块 */
.main-default-content > video /* 如果视频本身是顶级块 */
 {
    break-inside: avoid-column;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;

    margin-bottom: 1.2em; /* 内容块之间的垂直间距 */
}

.main-default-content > *:last-child {
    margin-bottom: 0;
}

/* 图片和视频处理 */
.main-default-content img,
.main-default-content video {
    max-width: 100%;    /* 确保图片/视频不超过其【所在列】的宽度 */
    height: auto;       /* 保持宽高比 */
    display: block;     /* 避免图片下方出现额外空隙 */
    border-radius: 4px;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.main-default-content p > img:first-child:last-child,
.main-default-content > img {
    margin-top: 0;
}

.main-default-content figure {
    margin-left: 0;
    margin-right: 0;
}

.main-default-content figure img {
    margin-top: 0;
    margin-bottom: 0.5em;
}

.main-default-content figcaption {
    font-size: 0.9em;
    color: #555;
    text-align: center;
    margin-top: 0.25em;
}

.main-default-content ul,
.main-default-content ol {
    padding-left: 20px;
}
.main-default-content li {
    margin-bottom: 0.5em;
}
.main-default-content li:last-child {
    margin-bottom: 0;
}
@media (max-width: 781px) {
	
	.main-default-content {
		overflow-y: auto;
	}
	.main-default-content .entry-content {
    height: auto;
    box-sizing: border-box;
    padding: 20px 20px 20px 0;
    margin-left: 0;
    margin-right: 0;
    overflow-y: auto;
    overflow-x: hidden;
    column-width: unset;
}
body.page-template-horizontal .main-default-content .entry-content, body.post-template-horizontal .main-default-content .entry-content {
    width: auto !important;
}

.main-default-content .entry-content .wp-block-image {
height: auto;
}
}