/* ============================================================
   个人网站 - 共用样式
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #ffffff;
    --fg: #000000;
    --border: #000000;
    --hover-bg: #000000;
    --hover-fg: #ffffff;
}

/* 消除手机浏览器点击 300ms 延迟 */
html, body {
    touch-action: manipulation;
}

html, body {
    width: 100%;
    min-height: 100%;
}

body {
    font-family: Arial, "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--fg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative; /* 让页脚有绝对定位的参照物 */
    padding-bottom: 80px; /* 防止页脚遮挡最底部的内容 */
    transition: background-color 0.2s ease;
}

a {
    color: var(--fg);
    text-decoration: none;
}

/* ===== 顶部栏 ===== */

.top-bar {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 20px 4%;
}

.top-bar .back {
    border: 1px solid var(--border);
    padding: 10px 20px;
    font-size: 15px;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.top-bar .back:hover {
    background: var(--hover-bg);
    color: var(--hover-fg);
}

/* ===== 大按钮 ===== */

.btn {
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px solid var(--border);
    background: var(--bg);
    color: var(--fg);
    font-size: clamp(18px, 1.8vw, 28px);
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease, transform 0.08s ease;
    padding: 10px;
    line-height: 1.3;
}



/* 点击时变黑（所有设备，浏览器原生 :active，无 JS 延迟） */
.btn:active,
.top-bar .back:active,
.timeline-toggle:active,
#timelineToggle:active {
    background: var(--hover-bg) !important;
    color: var(--hover-fg) !important;
}

/* 桌面端鼠标悬停变黑 */
@media (hover: hover) and (pointer: fine) {
    .btn:hover,
    .top-bar .back:hover,
    .timeline-toggle:hover,
    #timelineToggle:hover {
        background: var(--hover-bg);
        color: var(--hover-fg);
    }
}

/* 手机按下（JS 添加）：只变黑，不变形 */

/* ===== 页面标题 ===== */

.page-title {
    flex-shrink: 0;
    text-align: center;
    font-size: clamp(24px, 3vw, 36px);
    font-weight: normal;
    padding: 0 4% 20px 4%;
    margin: 0;
}

/* ===== 内容区 ===== */

.content-area {
    flex: 1;
    min-height: 0;
    margin: 0 4% 2% 4%;
    border: 2px solid var(--border);
    padding: 30px;
    font-size: 17px;
    line-height: 1.8;
    overflow-y: auto;
}

.content-area p {
    margin-bottom: 12px;
}

/* ===== 页脚 ===== */

.footer {
    margin-top: auto;
    flex-shrink: 0;
    padding: 10px 4% 14px 4%;
    text-align: right;
    font-size: 12px;
}

.footer a {
    opacity: 0.55;
}

.footer a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ===== 手机端 ===== */

@media (max-width: 700px) {
    .top-bar {
        padding: 14px 5%;
        gap: 8px;
    }
    .top-bar .back {
        margin: 0;
        padding: 3px 8px !important; /* 强制压到最小边距 */
        font-size: 12px !important;  /* 强制缩小字号 */
        line-height: 1 !important;
        height: 26px !important;     /* 强制固定一个非常小的高度 */
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 0 !important;
    }
    .content-area {
        margin: 0 5% 3% 5%;
        padding: 20px;
        font-size: 15px;
    }
}


/* ===== 右下角备案号 ===== */
/* 悬浮 footer 已彻底移除，恢复正常文档流 */

.footer a,
.page-footer a {
    color: inherit;
    text-decoration: none;
}

/* 给 body 留出底部空间 */
body {
    padding-bottom: 22px;
}


/* ==========================================
   强制取消全站顶栏/头部的固定在顶部的效果
   针对 .top-bar 和 .sticky-header
   ========================================== */
.top-bar,
.sticky-header,
.fixed-header {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    z-index: auto !important;
}

/* 针对个别页面把 .top-bar 写死为 fixed 的兜底 */
@media (max-width: 700px) {
    .top-bar, .sticky-header {
        position: static !important;
    }
}


/* ==========================================
   全站页脚终极修复：绝对固定在整个页面的最右下角
   ========================================== */
.footer,
.page-footer {
    position: absolute !important;
    bottom: 15px !important;
    right: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    text-align: right !important;
    font-size: 12px;
    background: transparent !important;
    width: auto !important;
}

/* 手机端页脚安全距离 */
@media (max-width: 700px) {
    .footer, .page-footer {
        bottom: 35px !important; /* 手机端保留一点高度防底栏遮挡 */
        right: 15px !important;
    }
}
