/* =========================================================
   统一的最后一层：字级、按钮手感、弹窗和手机交互
   只调视觉与交互，不改页面结构
   ========================================================= */

:root {
    --ease-out: cubic-bezier(.2, .8, .2, 1);
    --ease-spring: cubic-bezier(.18, .9, .3, 1.12);
}

body {
    font-size: 16.5px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

#about h3,
#work h3,
#journey h3 {
    font-size: clamp(30px, 2.4vw, 33px);
    font-weight: 700;
}

.about-owner-name {
    font-size: 19px;
    font-weight: 700;
}

.about-content,
.about-right .about-content {
    font-size: 14.5px;
    line-height: 1.95;
}

.post-card .card-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
}

.post-card .card-description {
    font-size: 13.5px;
    line-height: 1.6;
}

.post-card .card-category,
.post-card .post-date,
.post-card .post-likes {
    font-size: 12.5px;
}

.journey-item-content {
    font-size: 14.5px;
    line-height: 1.8;
}

.article-content {
    font-size: 16.5px;
    line-height: 2;
}

.article-lead {
    font-size: 15.5px;
}

.archive-item-title {
    font-size: 18.5px;
    font-weight: 700;
}

.archive-item-excerpt {
    font-size: 13.5px;
    line-height: 1.65;
}

.auth-field input,
.profile-field input {
    font-size: 15.5px;
}

.profile-card h1 {
    font-size: clamp(32px, 3vw, 38px);
}

/* 按钮统一手感，但不影响尺寸和排版 */
button,
.profile-pick,
.profile-save,
.blog-filter,
.page-btn,
.page-number,
.article-like,
.article-pager-link,
.user-modal-actions button,
.user-edit-buttons button,
.user-logout,
.user-logout-confirm button,
.profile-frame-option,
.profile-dialog-home,
.comments-login-link {
    transition:
        background-color .18s var(--ease-out),
        border-color .18s var(--ease-out),
        color .18s var(--ease-out),
        box-shadow .18s var(--ease-out),
        transform .14s var(--ease-out),
        opacity .18s var(--ease-out);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    button:not(:disabled):hover,
    .profile-pick:hover,
    .profile-save:hover,
    .blog-filter:hover,
    .page-btn:hover,
    .page-number:hover,
    .article-like:hover,
    .article-pager-link:hover,
    .user-modal-actions button:not(:disabled):hover,
    .user-edit-buttons button:hover,
    .user-logout:hover,
    .profile-frame-option:hover,
    .profile-dialog-home:hover {
        transform: translateY(-1px);
    }
}

button:not(:disabled):active,
.profile-pick:active,
.profile-save:active,
.blog-filter:active,
.page-btn:active,
.page-number:active,
.article-like:active,
.article-pager-link:active,
.user-modal-actions button:not(:disabled):active,
.user-edit-buttons button:active,
.user-logout:active,
.profile-frame-option:active,
.profile-dialog-home:active {
    transform: translateY(1px) scale(.985);
}

button:focus-visible,
.profile-pick:focus-visible,
.profile-save:focus-visible,
.blog-filter:focus-visible,
.page-btn:focus-visible,
.page-number:focus-visible,
.article-like:focus-visible,
.article-pager-link:focus-visible,
.user-modal-actions button:focus-visible,
.user-edit-buttons button:focus-visible,
.user-logout:focus-visible,
.profile-frame-option:focus-visible,
.profile-dialog-home:focus-visible,
a:focus-visible {
    outline: 2px solid var(--theme-color);
    outline-offset: 3px;
}

button:disabled {
    cursor: default;
}

/* 手机菜单和抽屉动画 */
@keyframes drawerIn {
    from { opacity: 0; transform: translateX(14px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dialogIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.box:not(.box-hide) {
    animation: drawerIn .26s var(--ease-out);
}

.box-overlay:not(.box-overlay-hide) {
    animation: overlayIn .18s ease-out;
}

.user-modal-card {
    animation: drawerIn .22s var(--ease-out);
}

.profile-dialog-card {
    animation: dialogIn .24s var(--ease-spring);
}

/* 弹窗打开时不让背后的页面继续滚动 */
body.menu-open {
    overflow: hidden !important;
}

body:has(.profile-dialog:not([hidden])) {
    overflow: hidden;
}

/* 手机端：更好点按，输入框不触发 iOS 缩放 */
@media screen and (max-width: 760px) {
    .box {
        max-height: calc(100dvh - 40px);
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
        overscroll-behavior: contain;
    }

    .user-modal-card {
        max-height: calc(100dvh - 84px);
        overscroll-behavior: contain;
    }

    .profile-dialog {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .blog-filter,
    .page-btn,
    .page-number,
    .article-like,
    .profile-pick,
    .profile-save,
    .user-modal-actions button,
    .user-edit-buttons button,
    .profile-frame-option,
    .profile-dialog-home,
    .box-li {
        min-height: 44px;
    }

    .archive-search input,
    .comment-form textarea,
    .auth-field input,
    .profile-field input {
        font-size: 16px;
    }

    .article-content {
        font-size: 16.5px;
        line-height: 1.95;
    }

    .post-card .card-title {
        font-size: 17px;
    }

    #about h3,
    #work h3,
    #journey h3 {
        font-size: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
