/* ===========================
   班级日报 — 报纸式自动交错 CSS
   =========================== */

/* 全局基础 */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@700&family=Lora&display=swap');

:root {
    --bg: #fdfdf8;
    --text: #222;
    --muted: #666;
    --accent: #000;
    --gap: 1rem;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Lora', serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.55;
}

/* ===== 报头 ===== */

.masthead {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1.1rem 2rem;
    border-bottom: none; /* 4px double var(--accent); /* 分割线移至底部 */
}

.masthead-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mode-switch-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.masthead-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.masthead .title h1 {
    margin: 0;
    font-size: 2rem;
    font-family: 'Merriweather', serif;
    letter-spacing: 0.5px;
}

.masthead .title p {
    margin: 0;
    color: #555;
    font-style: italic;
    font-size: 0.95rem;
}

.masthead .logo img {
    max-height: 64px;
    display: block;
}

/* ===== 新闻列表容器 ===== */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

/* ===== 单条新闻（核心） ===== */
/* 使用 flex 布局：默认行内（标题左，内容右） */
.news-item {
    display: flex;
    align-items: flex-start;
    gap: var(--gap);
    /* 为了视觉“栏位”感，使用占比：标题 1 / 内容 2 */
    /* 通过 flex-basis 和 flex-grow 实现稳定比例 */
}

.news-item .news-title {
    flex: 0 0 31%;
    /* 标题占比 ~31% */
    max-width: 31%;
    font-family: 'Merriweather', serif;
    font-size: 1.18rem;
    font-weight: 700;
    align-self: flex-start;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid var(--accent);
    margin: 0;
    line-height: 1.25;
    text-align: left;
}

/* 正文占剩余空间 */
.news-item .news-content {
    flex: 1 1 0%;
    min-width: 0;
    /* 使长文本能正确换行 */
    text-align: justify;
    color: var(--text);
}

/* ===== 自动交错：偶数条反向排列 ===== */
.news-item:nth-child(even) {
    /* 将顺序反转，保证标题显示在右侧，但仍保持原有占比（通过 row-reverse） */
    flex-direction: row-reverse;
}

/* 偶数条的标题右对齐以符合视觉 */
.news-item:nth-child(even) .news-title {
    text-align: right;
}

/* 偶数条正文仍然两端对齐（默认） */
.news-item:nth-child(even) .news-content {
    text-align: justify;
}

/* 防止单条新闻被分页或折断（在打印/列中） */
.news-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

/* ===== 小修饰：首字下沉 (可选) ===== */
.news-item .news-content:first-letter {
    float: left;
    font-size: 2em;
    line-height: 1;
    margin: 0 0.15em 0 0;
    font-weight: 700;
}

/* ===== 页脚 ===== */
footer {
    text-align: center;
    border-top: 2px solid var(--accent);
    padding: 1rem 0;
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 2rem;
}

.mode-switch {
    text-align: center;
    margin: 24px 0 12px 0;
}

.mode-switch-center {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px 0 0 0;
}

.switch-btn {
    background: #f5f5f5;
    border: 1px solid #bbb;
    color: #333;
    font-size: 1.1em;
    padding: 8px 24px;
    margin: 0 8px;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border 0.2s;
}

.switch-btn.active {
    background: #3a7bd5;
    color: #fff;
    border-color: #3a7bd5;
    font-weight: bold;
}

.switch-btn:hover {
    background: #e0e7ff;
    color: #1a237e;
}

.sensitive-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

/* 图片新闻区敏感内容居中 */
.image-news .sensitive-row,
.image-news .sensitive-unlock,
.image-news .sensitive-content {
    justify-content: center;
    text-align: center;
}
.image-news .sensitive-row {
    width: 100%;
}
.image-news .sensitive-unlock {
    flex-direction: row;
    width: auto;
}

.sensitive-flag {
    display: inline-block;
    background: #ffebee;
    color: #c62828;
    font-size: 0.95em;
    padding: 2px 10px;
    border-radius: 12px;
    margin-bottom: 0;
    font-weight: bold;
}

.sensitive-unlock {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sensitive-pwd {
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid #bbb;
    font-size: 1em;
}

.sensitive-btn {
    padding: 4px 12px;
    margin-left: 8px;
    border-radius: 8px;
    border: none;
    background: #3a7bd5;
    color: #fff;
    cursor: pointer;
}

.sensitive-btn:hover {
    background: #1976d2;
}

.sensitive-msg {
    color: #c62828;
    margin-left: 12px;
    font-size: 0.95em;
}

/* ===== 响应式：移动端处理 ===== */
@media (max-width: 900px) {
    .news-list {
        padding: 1.2rem;
        gap: 1.6rem;
    }

    .masthead {
        padding: 0.9rem 1.2rem;
    }

    .masthead .title h1 {
        font-size: 1.6rem;
    }

    .news-item .news-title {
        flex-basis: 36%;
        max-width: 36%;
        font-size: 1.05rem;
    }
}

@media (max-width: 640px) {

    /* 在窄屏上，每条新闻堆叠：标题在上，正文在下（更适合手机） */
    .news-item {
        flex-direction: column;
        gap: 0.6rem;
        align-items: stretch;
    }

    /* 恢复标题左对齐（阅读习惯） */
    .news-item .news-title {
        flex: 0 0 auto;
        max-width: 100%;
        text-align: left;
        border-bottom: 1px solid rgba(0, 0, 0, 0.12);
        font-size: 1.02rem;
    }

    .news-item .news-content {
        text-align: left;
    }

    .masthead {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
        padding: 1rem;
    }

    .masthead .logo img {
        max-height: 48px;
    }

    .news-list {
        padding: 1rem;
    }
}

/* ===== 打印优化（可选） ===== */
@media print {
    body {
        background: #fff;
        color: #000;
    }

    .masthead {
        border-bottom: 2px solid #000;
    }

    .news-item .news-content:first-letter {
        float: none;
        font-size: inherit;
    }
}

/* ===== 页脚 ===== */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid var(--accent);
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 2rem;
}

.footer-left {
    text-align: left;
}

.footer-right {
    text-align: right;
}

/* 移动端：改为上下堆叠 */
@media (max-width: 640px) {
    footer {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .footer-left,
    .footer-right {
        text-align: center;
        width: 100%;
    }
}

/* 新闻标题下方横线 + 小装饰点 
.news-title {
    font-family: 'Merriweather', serif;
    font-size: 1.18rem;
    font-weight: 700;
    padding-bottom: 0.25rem;
    margin: 0 0 0.5rem 0;
    border-bottom: 2px solid var(--accent);
    position: relative;
} */

/* 小装饰点 */
.news-title::after {
    content: "•";
    position: absolute;
    right: -1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--accent);
}

/* 新闻内容左右背景色模拟纸张分栏 */
.news-item .news-content {
    flex: 1 1 0%;
    min-width: 0;
    text-align: justify;
    color: var(--text);
    padding: 0.6rem 1rem;
    background-color: #fcfcf6;
    /* 浅米色，模拟纸张 */
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
}

.title p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 隐藏原生日期文本，仅显示按钮 */
#date-picker {
    width: 32px;
    padding: 0;
    border: none;
    background: none;
    color: transparent;
    cursor: pointer;
    position: relative;
}

#date-picker::-webkit-input-placeholder {
    color: transparent;
}

#date-picker::-webkit-datetime-edit,
#date-picker::-webkit-datetime-edit-fields-wrapper,
#date-picker::-webkit-datetime-edit-text,
#date-picker::-webkit-datetime-edit-month-field,
#date-picker::-webkit-datetime-edit-day-field,
#date-picker::-webkit-datetime-edit-year-field {
    color: transparent;
    display: none;
}

#date-picker::-webkit-calendar-picker-indicator {
    opacity: 1;
    filter: none;
    cursor: pointer;
}

#date-picker::-ms-input-placeholder {
    color: transparent;
}

#date-picker::-moz-placeholder {
    color: transparent;
}

#date-picker:-moz-placeholder {
    color: transparent;
}

#date-picker::-o-placeholder {
    color: transparent;
}

#date-picker::-placeholder {
    color: transparent;
}

.date-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.announcement-bar {
    max-width: 1100px;
    margin: 1em auto;
    margin-top: auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-bottom: 0.5rem;
    border-bottom: 4px double var(--accent); /* 分割线移到公告栏下面 */
}

/* 公告块公共样式 */
.announcement {
    padding: 0.6rem 1rem;
    border-radius: 3px;
    font-size: 0.9rem;
    line-height: 1;
    color: #fff;
}

/* 类型颜色 */
.announcement.info {
    background-color: #2b7cff;
    /* 蓝色 */
}

.announcement.warning {
    background-color: #e63946;
    /* 红色 */
}

.announcement.notice {
    background-color: #f77f00;
    /* 橙色 */
}

.announcement .icon svg {
    width: auto;
    /* 或像素值，如 24px */
    height: auto;
    vertical-align: sub;
    zoom: 75%;
    margin-right: 1em;
}