/* ===== 文章页封面 hero banner =====
 * 用 page.cover 作背景图 + 渐变遮罩，标题与元信息叠在图上；
 * 无 cover 时退回 surface 容器渐变(post-hero--tonal)。
 */

.post-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    width: 100%;
    min-height: clamp(200px, 30vw, 360px);
    margin: 0 0 12px;
    border-radius: 28px;
    overflow: hidden;
    isolation: isolate;
    box-sizing: border-box;
    background: var(--s-color-surface-container-high);
}

/* 无封面时的回退底色 */
.post-hero--tonal {
    background: linear-gradient(
        135deg,
        var(--s-color-surface-container) 0%,
        var(--s-color-surface-container-high) 100%
    );
}

.post-hero__img {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    /* 图片加载失败时不留白 */
    background: var(--s-color-surface-container-high);
}

/* 底部深色遮罩，保证白色标题可读 */
.post-hero__scrim {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.78) 0%,
        rgba(0, 0, 0, 0.55) 32%,
        rgba(0, 0, 0, 0.18) 68%,
        rgba(0, 0, 0, 0) 100%
    );
}

.post-hero__content {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: clamp(24px, 4vw, 44px) clamp(24px, 5vw, 56px);
    box-sizing: border-box;
    font-family: 'banner', var(--materialis-font-family);
}

.post-hero__title {
    max-width: 24ch;
    margin: 0 0 20px;
    font-size: clamp(2rem, 3.5vw, 3.25rem);
    font-weight: var(--s-typescale-display-small-weight, 400);
    line-height: 1.12;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.post-hero--cover .post-hero__title {
    color: #fff;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.post-hero--tonal .post-hero__title {
    color: var(--s-color-on-surface);
}

/* ===== 元信息 chips ===== */

.post-banner-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-family: var(--materialis-font-family);
}

.post-banner-chip {
    flex: 0 1 auto;
    width: auto;
    max-width: min(100%, 240px) !important;
    min-height: 34px !important;
    height: auto !important;
    padding: 5px 12px !important;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--s-color-outline) 30%, transparent);
    color: var(--s-color-on-surface) !important;
    font-family: var(--materialis-font-family);
    font-size: 0.82rem !important;
    line-height: 1.2;
}

.post-banner-chip-date {
    background: var(--s-color-primary-container) !important;
    color: var(--s-color-on-primary-container) !important;
}

.post-banner-chip-category {
    background: var(--s-color-secondary-container) !important;
    color: var(--s-color-on-secondary-container) !important;
}

.post-banner-chip-tag {
    background: var(--s-color-tertiary-container) !important;
    color: var(--s-color-on-tertiary-container) !important;
}

.post-banner-chip-readtime,
.post-banner-chip-views {
    background: color-mix(in srgb, var(--s-color-surface-container-highest) 85%, transparent) !important;
    color: var(--s-color-on-surface-variant) !important;
}

.post-banner-chip-readtime span,
.post-banner-chip-views span {
    font-variant-numeric: tabular-nums;
}

.post-banner-chip material-icon {
    flex: 0 0 auto;
    font-size: 1rem;
}

/* 有封面时 chip 统一为半透明毛玻璃，避免彩色 chip 压在照片上过花 */
.post-hero--cover .post-banner-chip {
    background: rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.34);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .post-hero {
        min-height: clamp(170px, 42vw, 240px);
        border-radius: 24px;
    }

    .post-hero__content {
        padding: 28px 24px 24px;
    }

    .post-hero__title {
        margin-bottom: 16px;
        font-size: clamp(1.9rem, 9vw, 2.5rem);
    }
}

@media (max-width: 600px) {
    .post-banner-meta { gap: 6px; }

    .post-banner-chip {
        min-height: 32px !important;
        padding: 4px 10px !important;
        font-size: 0.78rem !important;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .post-hero--cover .post-banner-chip {
        background: rgba(0, 0, 0, 0.55) !important;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}
