/* 独立 CV 页（cv.html） */
body.cv-page {
    margin: 0;
    padding: 0;
    background: rgb(246, 246, 246);
}

/* ===== 首页 CV 滑出面板：与 About 面板镜像，以左上角为轴旋转滑入 ===== */
#cv-panel {
    position: fixed;
    top: 0;
    /* 旋转时左下角会向右摆、右上角会向左收，屏幕边缘会露出缝。
       所以面板向左（轴心侧）多出 30vw、向右多出 5vw，用内边距把内容放回屏幕范围 */
    /* 顺时针旋转时右下角会向左收，所以向右（远端）多出 30vw、向左多出 5vw */
    left: -5vw;
    width: 135vw;
    height: 100vh;
    box-sizing: border-box;
    padding: 0 30vw 0 5vw;
    background: rgb(255, 255, 255);
    /* 与 Extra Links 面板同层（对侧按钮在打开时会隐藏），只留右上角 Return */
    z-index: 9000;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    pointer-events: none;
    /* 轴心仍是屏幕左上角（元素内 30vw 处）
       与 Extra Links 面板镜像：那边以右上角为轴 rotate(15deg)，这边以左上角为轴 rotate(-15deg)
       关闭时多上移 10vw，确保加宽的部分也在屏幕外 */
    /* 轴心仍是屏幕左上角（元素内 5vw 处），顺时针 15° 旋入。
       顺时针时右端下垂约 34vw，关闭时多上移 36vw 保证整块在屏幕外 */
    transform-origin: 5vw 0;
    transform: translateY(calc(-100% - 36vw)) rotate(15deg);
    transition: transform 0.6s ease;
    /* 底边与 Extra Links 镜像（轴心侧高、远端低）：屏幕左缘 90%、右缘 96%，斜率延伸到加宽部分 */
    clip-path: polygon(0 0, 100% 0, 100% 97.8%, 0 89.7%);
    will-change: transform;
    backface-visibility: hidden;
}

/* Extra Links 打开时 CV 面板退到它下面。
   否则关闭 CV 后马上点 Extra Links，还在滑出的 CV 会压住它的斜边，看起来像变平了 */
body.about-open #cv-panel {
    z-index: 8990;
}

/* 文字随面板旋转逐渐出现，关闭时先淡出 */
#cv-panel .cv {
    opacity: 0;
    transition: opacity 0.3s ease;
}

#cv-panel.active .cv {
    opacity: 1;
    transition: opacity 0.7s ease 0.15s;
}

#cv-panel::-webkit-scrollbar {
    display: none;
}

#cv-panel.active {
    transform: translateY(0) rotate(0deg);
    pointer-events: auto;
}


/* CV 面板打开时，Return 下方显示「在新页面打开」 */
#cv-fullpage {
    position: fixed;
    /* 左侧 › Return 下方，与按钮文字对齐 */
    top: 10vh;
    left: 5vw;
    z-index: 10001;
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.4vh;
    color: #555;
    text-decoration: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

body.cv-open #cv-fullpage {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.3s;
    /* 与 learn more 同样的呼吸（linkBreathe 定义在 main.css），淡入后开始 */
    animation: linkBreathe 2s ease-in-out 0.8s infinite;
}

body.cv-open #cv-fullpage:hover {
    animation: none;
    opacity: 1;
}

#cv-fullpage:hover .nav-text {
    background-position: left 92%;
    background-size: 100% 1px;
}

/* ===== CV 正文 ===== */
.cv {
    /* 项目页的 projects.css 把所有元素设为 border-box，会把内边距算进 max-width 导致变窄；
       这里固定为 content-box，首页、项目页、cv.html 三处宽度一致 */
    box-sizing: content-box;
    color: #111;
    font-family: 'Lato', sans-serif;
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
}

.cv {
    max-width: 820px;
    margin: 0 auto;
    padding: 16vh 6vw 14vh;
    font-size: 15.5px;
    line-height: 1.65;
}

/* ---------- 抬头 ---------- */
.cv-name {
    font-family: 'Lato', sans-serif;
    font-weight: 100;
    font-size: clamp(52px, 9vw, 96px);
    line-height: 1;
    margin: 0 0 0.25em;
    letter-spacing: -0.01em;
}

.cv-name .first-letter {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 1.15em;
}

.cv-contact {
    font-family: 'Cormorant Garamond', serif;
    font-size: 19px;
    color: #444;
    margin: 0 0 3.5em;
}

.cv-contact a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.cv-contact a:hover {
    border-bottom-color: #000;
}

.cv-contact .sep {
    margin: 0 0.6em;
    color: #aaa;
}

/* ---------- 章节 ---------- */
.cv section {
    margin-bottom: 3em;
}

.cv h2 {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 30px;
    margin: 0 0 0.6em;
    padding-bottom: 0.25em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.entry {
    margin-bottom: 1.6em;
}

.entry-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1em;
}

.entry-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    line-height: 1.3;
    color: #000;
}

.entry-date {
    flex-shrink: 0;
    font-size: 13px;
    letter-spacing: 0.06em;
    color: #777;
    white-space: nowrap;
}

.entry-sub {
    font-size: 14px;
    color: #555;
    margin: 0.1em 0 0.5em;
}

.cv p {
    margin: 0 0 0.6em;
}

.cv ul {
    margin: 0.3em 0 0;
    padding-left: 1.1em;
}

.cv li {
    margin-bottom: 0.45em;
}

.cv li::marker {
    color: #999;
}

.cv strong {
    font-weight: 300;
    color: #000;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.15em;
}

.plain-list {
    list-style: none;
    padding-left: 0 !important;
}

/* ---------- 窄屏 ---------- */
@media (max-width: 640px) {
    .cv {
        padding-top: 14vh;
    }

    .entry-head {
        flex-direction: column;
        gap: 0;
    }
}

/* ---------- 打印 / 另存为 PDF ---------- */
@page {
    size: A4;
    margin: 16mm 16mm 18mm;
}

@media print {
    body.cv-page {
        background: #fff;
    }

    #home-toggle {
        display: none !important;
    }

    .cv {
        max-width: none;
        padding: 0;
        font-size: 10pt;
        line-height: 1.5;
    }

    .cv-name {
        font-size: 40pt;
    }

    .cv-contact {
        font-size: 12pt;
        margin-bottom: 2em;
    }

    .cv h2 {
        font-size: 17pt;
    }

    .entry-title {
        font-size: 13pt;
    }

    .entry-date,
    .entry-sub {
        font-size: 9pt;
    }

    .entry,
    .cv li {
        break-inside: avoid;
    }

    .cv h2 {
        break-after: avoid;
    }

    .cv-contact a {
        border-bottom: none;
    }
}
