/* ========================================
   Coco's Home - 样式文件
   ======================================== */

/* ============ 基础重置 ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', 'Futura', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

button,
input,
textarea,
select {
    font-family: inherit;
}

/* ============ 头部导航 ============ */
header {
    background: white;
    padding: 24px 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    border-bottom: rgba(0, 0, 0, 0.1) 0.5px solid;
}

nav {
    display: flex;
    gap: 20px;
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 99px;
    background: #f7f7f7;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    color: rgba(0, 0, 0, 0.5);
    font-weight: 600;
}

.nav-btn.active {
    background: #000;
    color: white;
}

/* ============ 用户区域 ============ */
.user-section {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    right: 40px;
    cursor: pointer;
}

.user-section:hover {
    opacity: 0.7;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-image: url('/assets/imgs/avatar.jpg');
    background-size: 100% 100%;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.5);
}

/* ============ 主容器布局 ============ */
.container {
    display: flex;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    z-index: 1;
}

/* ============ 侧边栏 ============ */
.sidebar {
    width: 240px;
    min-width: 180px;
    max-width: 400px;
    flex-shrink: 0;
    padding-right: 15px;
    padding-top: 140px;
    margin-left: max(40px, calc((100vw - 1400px) / 2));
    transition: width 0.3s ease;
    position: sticky;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar.hidden {
    display: none;
}

.sidebar-intro {
    line-height: 1.8;
    color: #666;
    font-size: 14px;
    margin-bottom: 25px;
    font-weight: 300;
}

.intro-title {
    color: #808080;
    font-weight: 600;
}

.sidebar-section {
    margin-bottom: 20px;
}

/* ============ 标签 ============ */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.tag {
    display: inline-block;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 12px;
    color: #808080;
    white-space: nowrap;
    /* 添加以下三行 */
    -webkit-tap-highlight-color: transparent;
    /* 禁用点击高亮 */
    -webkit-touch-callout: none;
    /* 禁用长按菜单 */
    user-select: none;
    /* 禁止选中文字 */
}

@media (hover: hover) and (pointer: fine) {
    .tag:hover {
        background: #f8f8f8;
    }
}

.tag.active {
    background-color: #000;
    color: white;
    border-color: #000;
}

/* ============ 分隔条 ============ */
.divider {
    width: 100px;
    position: sticky;
    top: 0;
    cursor: col-resize;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    user-select: none;
    transition: all 0.3s ease;
    height: 100vh;
    flex-shrink: 0;
    padding-top: 140px;
}

.divider.hidden {
    display: none;
}

.divider::before {
    content: '';
    position: absolute;
    width: 0.5px;
    height: 100vh;
    top: 0;
    background: rgba(0, 0, 0, 0.1);
    left: 50%;
    transform: translateX(-50%);
}

.divider::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 28px;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    border-radius: 99px;
    left: 50%;
    top: 400px;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
}

.divider:hover::after {
    opacity: 1;
}

.divider.dragging::after {
    opacity: 1;
    background: #f0f0f0;
}

body.resizing {
    cursor: col-resize;
    user-select: none;
}

body.resizing * {
    cursor: col-resize !important;
}

/* ============ 内容区域 ============ */
.content {
    flex: 1;
    padding-left: 15px;
    padding-top: 140px;
    padding-bottom: 40px;
    padding-right: max(40px, calc((100vw - 1400px) / 2 + 40px));
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    position: relative;
}

.content::-webkit-scrollbar {
    width: 8px;
}

.content::-webkit-scrollbar-track {
    background: transparent;
}

.content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

.content.full-width {
    padding-left: max(40px, calc((100vw - 1400px) / 2 + 40px));
    padding-right: max(40px, calc((100vw - 1400px) / 2 + 40px));
}

/* ============ 卡片网格 ============ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px 30px;
    padding-bottom: 40px;
    align-items: start;
}

.card {
    background: transparent;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    /* 👇 新增这一行：禁用手机浏览器默认的灰色点击背景，用我们自定义的效果代替 */
        -webkit-tap-highlight-color: transparent;
}
/* ============ 新增：卡片点击/按压反馈 ============ */
.card:active {
    /* 1. 缩放效果：稍微缩小一点，模拟被按下去的感觉 */
    transform: scale(0.96) !important;

    /* 2. 透明度：稍微变暗/变透，强化视觉反馈 */
    opacity: 0.85;

    /* 3. 过渡时间：设为 0.1s 甚至更短，让反馈非常灵敏 */
    transition: all 0.1s ease;
}

@media (hover: hover) and (pointer: fine) {
    .card:hover {
        transform: translateY(-6px);
    }
}

.card.card-large .card-image {
    height: 450px;
    max-width: 100%;
}

.card-image {
    width: 100%;
    height: 160px;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    object-fit: cover;
    object-position: top center;
    border-radius: 10px;
    image-rendering: high-quality;
    image-rendering: -webkit-optimize-contrast;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    will-change: transform;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    image-orientation: from-image;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.card-image[autoplay] {
    display: block;
}

.card-image[src] {
    background: linear-gradient(135deg, #f5f5f5 0%, #fafafa 100%);
}

.card-content {
    padding: 15px 5px 0 5px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #4f4f4f;
}

.card-desc {
    font-size: 13px;
    color: #999;
    line-height: 1.6;
}

/* 图片懒加载样式 */
.card-image.lazy {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-image.lazy[src] {
    opacity: 1;
}

/* 图片加载中的占位背景 */
.card-image {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

/* 图片加载完成后移除背景 */
.card-image[src]:not(.lazy) {
    background: none;
}

/* 我的作品标签 */
.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 99px;
    backdrop-filter: blur(4px);
    z-index: 10;
}

.card.my-project {
    position: relative;
}

.card.my-project .card-image {
    border: 1.5px solid rgba(0, 191, 220, 0.3);
}

.no-results {
    text-align: center;
    padding: 60px;
    color: #999;
    font-size: 14px;
}

/* Code Lab 图片切换效果 */
.codelab-image {
    transition: opacity 0.3s ease;
}

.codelab-card:hover .codelab-image {
    opacity: 1;
}

/* ============ 页面切换 ============ */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ============ Blog 页面 ============ */
.blog-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 40px 20px;
}

.blog-section {
    margin-bottom: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.blog-section-title {
    font-size: 14px;
    color: #999;
    margin-bottom: 20px;
    text-align: center;
}

.blog-item-content {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 15px;
}

.blog-item-content:hover {
    color: #333;
    text-decoration: none;
}

/* ============ 模态框基础 ============ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-overlay.active {
    display: flex;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============ Profile 模态框 ============ */
.modal-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 90vh;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    animation: slideUp 0.3s ease;
    color: #4f4f4f;
    font-weight: 400;
    display: flex;
    flex-direction: column;
}

.modal-header {
    position: sticky;
    top: 0;
    right: 0;
    height: 60px;
    background: white;
    z-index: 10;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 28px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.3s;
}

.modal-close:hover {
    color: #333;
    transform: rotate(90deg);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 40px 60px 40px;
}

/* --- 新增：手机端适配 --- */
/* 当屏幕宽度小于 768px 时（通常是手机） */
@media (max-width: 768px) {
    .modal-body {
        /* 将左右 padding 改为 20px，底部改为 30px 或 40px */
        padding: 0 10px 40px 10px;
    }
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 30px;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-intro {
    text-align: center;
    line-height: 2;
    color: #666;
    font-size: 15px;
    margin-bottom: 50px;
}

.profile-intro h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
    font-weight: 500;
}

.profile-intro p {
    margin: 0;
}

.project-showcase {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px;
}

.project-showcase:hover {
    transform: translateY(-2px);
    transition: all 0.3s;
}

.project-showcase-title {
    font-size: 15px;
    color: #4f4f4f;
    margin-bottom: 8px;
    font-weight: 600;
}

.project-showcase-link {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    word-break: break-all;
}

.project-showcase-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
}

.project-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.project-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.profile-footer {
    text-align: center;
    font-size: 14px;
    color: #999;
}

.download-resume {
    color: #333;
    cursor: pointer;
    text-decoration: underline;
    transition: all 0.3s;
}

.download-resume:hover {
    color: #666;
}

/* ============ 验证模态框 ============ */
.verification-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.verification-modal.active {
    display: flex;
}

.verification-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: slideUp 0.3s ease;
}

.verification-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 24px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.3s;
}

.verification-close:hover {
    color: #333;
}

.verification-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.verification-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
    text-align: center;
}

.verification-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.verification-input:focus {
    outline: none;
    border-color: #000;
}

.verification-input.error {
    border-color: #ff4444;
}

.verification-error {
    color: #ff4444;
    font-size: 13px;
    margin-top: -15px;
    margin-bottom: 15px;
    display: none;
}

.verification-error.show {
    display: block;
}

.verification-btn {
    width: 100%;
    padding: 12px;
    background: #000;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.verification-btn:hover {
    background: #333;
}

.verification-btn:active {
    transform: scale(0.98);
}

/* ============ 响应式 - 中等屏幕 ============ */
@media (max-width: 1200px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 35px 25px;
    }

    .sidebar {
        margin-left: 40px;
    }

    .content {
        padding-right: 40px;
    }
}

@media (max-width: 900px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 30px 20px;
    }

    .card-image {
        height: 280px;
    }

    .sidebar {
        margin-left: 30px;
    }

    .content {
        padding-right: 30px;
    }
}

/* ============ 响应式 - 移动端 ============ */
@media (max-width: 600px) {

    /* 头部导航 */
    header {
        padding: 16px 20px;
        justify-content: space-between;
        font-size: 14px;
        z-index: 1000;
    }

    .user-section {
        right: 20px;
    }

    .user-name {
        display: none;
    }

    /* Body 和容器布局 */
    body {
        padding-top: 0;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .container {
        flex-direction: column;
        height: auto;
        position: static;
    }

    /* 侧边栏变为顶部内容 */
    .sidebar {
        height: auto;
        position: static;
        padding: 74px 0px 0px 0px;
        width: 100%;
        max-width: 500px;
        margin: 0;
    }

    .sidebar-intro {
        margin-bottom: 0;
        padding: 30px 20px 0px 20px;
    }

    .sidebar-section {
        position: static;
        transition: all 0.2s ease;
        margin-bottom: 0;
    }

    .tags-container {
        padding: 16px 10px 16px 20px;
        overflow-x: auto;
        display: flex;
        flex-wrap: nowrap;
        justify-content: left;
        gap: 16px;
        -webkit-overflow-scrolling: touch;
    }

    .tags-container::-webkit-scrollbar {
        display: none;
    }

    /* 滚动后固定样式 */
    .sidebar-section.fixed {
        width: 100%;
        position: fixed;
        z-index: 999;
        background-color: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(10px);
        top: 74px;
        overflow-x: auto;
        border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
    }

    /* 移除分隔条 */
    .divider {
        display: none;
    }

    /* 主内容区域 */
    .content {
        width: 100%;
        padding: 20px 20px 20px 20px;
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* 卡片网格 */
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding-bottom: 20px;
    }

    .card-image {
        height: 120px;
    }

    .card.card-large .card-image {
        height: 320px;
    }

    /* 模态框 */
    .modal-content {
        width: 90%;
        max-width: none;
        padding: 20px 24px;
        height: 80vh;
    }

    .profile-avatar {
        width: 90px !important;
        height: 90px !important;
    }

    .project-showcase>div {
        flex-direction: column;
        align-items: center;
    }

    .project-image {
        width: 90px !important;
        height: 90px !important;
    }

    /* 导航按钮 */
    nav {
        gap: 20px;
    }

    .nav-btn {
        padding: 10px 12px;
        font-size: 14px;
    }

    .content.blog-page {
        padding-top: 104px !important;
    }
}