/* today.5l5l.net 历史上的今天 — 主题样式 */
:root {
    --brand: #8a5a2b;          /* 羊皮纸棕（历史感） */
    --brand-dark: #5e3c1a;
    --accent: #b03a2e;         /* 警示红（大事记） */
    --bg: #faf6ef;             /* 暖白底 */
    --bg-soft: #f4ead8;
    --surface: #ffffff;
    --border: #e4d9c3;
    --text: #2b2118;
    --muted: #7a6a55;
    --ok: #2e7d32;
    --danger: #c62828;
    --radius: 10px;
    --shadow: 0 1px 4px rgba(94, 60, 26, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans SC", "Noto Sans TC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
}
img { max-width: 100%; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; }

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---- header ---- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding-top: 12px; padding-bottom: 12px;
}
.brand {
    font-size: 20px; font-weight: 700; color: var(--brand-dark);
    white-space: nowrap;
    display: inline-flex; align-items: center; min-height: 32px;
}
.nav-links { display: flex; gap: 14px; font-size: 15px; flex-wrap: wrap; }
.nav-links a { color: var(--muted); min-height: 32px; min-width: 32px; display: inline-flex; align-items: center; justify-content: center; }
.nav-links a:hover { color: var(--brand); }

.search-box { display: flex; flex: 1; min-width: 180px; max-width: 320px; margin-left: auto; }
.search-box input {
    flex: 1; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: 6px 0 0 6px; font-size: 14px; background: #fff;
    min-height: 36px;
}
.search-box button {
    background: var(--brand); color: #fff; border: 0; border-radius: 0 6px 6px 0;
    cursor: pointer; font-size: 14px; padding: 0 14px; min-height: 36px;
}
.search-box button:hover { background: var(--brand-dark); }

.lang-switch select {
    padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
    background: #fff; font-size: 14px; min-height: 36px; max-width: 140px;
}

/* ---- skip link / sr-only ---- */
.skip-link {
    position: absolute; left: -9999px; top: 0; background: var(--brand-dark);
    color: #fff; padding: 8px 14px; z-index: 999; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- hero ---- */
.hero {
    background: linear-gradient(135deg, #f4ead8, #fff8ef);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    margin: 20px 0;
    text-align: center;
}
.hero h1 { margin: 0 0 10px; font-size: clamp(24px, 4vw, 38px); color: var(--brand-dark); }
.hero p { margin: 4px 0; color: var(--muted); }
.hero-stats {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 24px;
    margin-top: 18px;
}
.stat strong { display: block; font-size: 26px; color: var(--brand-dark); }
.stat span { font-size: 13px; color: var(--muted); }

/* ---- section/chips/cards ---- */
.section { margin: 24px 0; }
.section h1 { font-size: clamp(22px, 3vw, 30px); margin-bottom: 6px; }
.section h2 { font-size: 22px; color: var(--brand-dark); border-bottom: 2px solid var(--border); padding-bottom: 8px; }
.section h2 a { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; min-width: 32px; }
/* 合规页正文内联链接：padding 扩点击区 */
.legal-page p a, .legal-page li a { padding: 8px 2px; }
.count-badge { font-style: normal; font-size: 14px; color: var(--muted); font-weight: 400; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border: 1px solid var(--border);
    background: #fff; border-radius: 999px; font-size: 14px;
    color: var(--text); min-height: 36px;
}
.chip em { font-style: normal; color: var(--muted); font-size: 12px; }
.chip:hover { background: #f4ead8; border-color: var(--brand); text-decoration: none; }
.chip-static { background: #fff; border-color: var(--border); cursor: default; }
.chip-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-active em { color: #ffe9c9; }

.btn {
    display: inline-block; padding: 9px 16px; border-radius: 6px;
    background: var(--brand); color: #fff; font-size: 14px; border: 0;
    min-height: 36px; cursor: pointer;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }

/* ---- grid ---- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 14px;
}
@media (max-width: 640px) {
    .grid { grid-template-columns: 1fr; }
    .site-header { position: static; }
}
.card {
    display: block; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 14px; color: var(--text); transition: transform .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(94,60,26,.14); text-decoration: none; }
.card h2, .card h3 { margin: 0 0 6px; font-size: 16px; color: var(--brand-dark); }
.card-meta { margin: 0; font-size: 13px; color: var(--muted); }
.card-meta span { display: block; }

/* ---- timeline（日期详情页）---- */
.timeline { list-style: none; margin: 14px 0; padding: 0; }
.timeline-item {
    display: flex; gap: 14px; padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: 0; }
.timeline-year {
    flex: 0 0 76px; font-weight: 700; color: var(--accent);
    font-variant-numeric: tabular-nums; text-align: right;
}
.timeline-body p { margin: 0 0 4px; font-size: 15px; }
/* 内联日期/正文链接：用 padding 扩点击区（不改行高） */
.timeline-body a { padding: 8px 6px; }
.source-link { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.source-link a { color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; min-height: 32px; min-width: 32px; }

/* ---- calendar（月份页）---- */
.calendar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 18px;
}
@media (max-width: 640px) {
    .calendar { grid-template-columns: repeat(5, 1fr); }
}
.calendar-day {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 10px 4px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; text-align: center; min-height: 64px;
}
.calendar-day:hover { border-color: var(--brand); text-decoration: none; }
.day-num { font-size: 18px; font-weight: 700; color: var(--brand-dark); }
.day-count { font-size: 12px; color: var(--muted); }
.day-count.empty { color: var(--border); }
.calendar-empty { opacity: .5; }
.calendar-empty:hover { opacity: 1; }

/* ---- date nav ---- */
.date-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.date-nav .btn { min-width: 120px; text-align: center; }

/* ---- 详情页通用 ---- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; min-height: 32px; min-width: 32px; }
.date-facts {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin: 16px 0;
}
.date-facts p { margin: 0 0 10px; font-size: 15px; }
.date-facts strong { color: var(--text); }
.date-section { margin: 22px 0; }
.date-section h2 { font-size: 20px; color: var(--brand-dark); border-bottom: 2px solid var(--border); padding-bottom: 6px; }
.lead { font-size: 16px; color: var(--muted); }

/* ---- ad slots（复用各站双向防 CLS 方案）---- */
.ad-slot { margin: 16px 0; text-align: center; overflow: hidden; }
.ad-label { margin: 0 0 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
ins.adsbygoogle {
    display: block; width: 100%; min-height: 100px;
    background: transparent;
}
.ad-top, .ad-bottom { min-height: 90px; }
.ad-in-article, .ad-in-feed { min-height: 120px; grid-column: 1 / -1; }
.ad-unfilled { opacity: 0; pointer-events: none; }
.ad-slot[hidden], ins.adsbygoogle[hidden] { display: none !important; }

/* ---- pager ---- */
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 20px 0; flex-wrap: wrap; }
.pager span { font-size: 14px; color: var(--muted); }

/* ---- empty / legal ---- */
.empty { color: var(--muted); font-size: 16px; }
.empty-page { text-align: center; padding: 40px 0; }
.legal-page { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.legal-page h1 { color: var(--brand-dark); }
.legal-page h2 { font-size: 17px; margin-top: 22px; color: var(--brand-dark); }
.legal-updated { font-size: 13px; color: var(--muted); }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 36px; padding: 20px 0; font-size: 14px; color: var(--muted); }
.site-footer .wrap > p { margin: 6px 0; }
.footer-links a { color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; min-height: 32px; min-width: 32px; }
.copy { font-size: 13px; }
.attribution { font-size: 12px; color: var(--muted); }

/* ---- consent banner ---- */
.consent-banner {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    background: #2b2118; color: #f5efe4; padding: 12px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,.2);
}
.consent-inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.consent-text { flex: 1; min-width: 240px; margin: 0; font-size: 14px; }
.consent-text a { color: #ffd9a0; }
.consent-actions { display: flex; gap: 10px; }
.consent-actions .btn-accept { background: var(--ok); color: #fff; }
.consent-actions .btn-reject { background: transparent; border: 1px solid #888; color: #f5efe4; }

/* ---- 小屏适配 ---- */
@media (max-width: 720px) {
    .header-inner { gap: 8px; }
    .brand { font-size: 17px; }
    .nav-links { order: 3; width: 100%; }
    .search-box { order: 4; max-width: none; margin-left: 0; }
    .lang-switch { order: 2; }
    .hero { padding: 20px 14px; }
    .timeline-item { flex-direction: column; gap: 2px; }
    .timeline-year { text-align: left; }
}