﻿/* Table of Content
=======================================================================
1. Color Palette
2. Header Styles
3. Profile Picture Styles
4. Quote Styles
5. Main Content Styles
6. Footer Styles
7. Link Styles
8. Typography
============================================================ */
/* 1. Color Palette */
header,
.intro,
h1,
p {
  margin: 0;
  padding: 0;
}
/* 在现有:root下方添加 */
:root {
    --main-color: #050505; /* 夜间模式背景 */
    --second-color: #602c8e;
    --third-color: #ffffff; /* 夜间模式文字 */
    --neutral-white: #f7f7f7;
    --spacing: 16px;
    --radius: 8px;
}

    /* 白天模式变量 */
    :root.light-mode {
        --main-color: #ffffff; /* 白天模式背景 */
        --second-color: #7a3ca8;
        --third-color: #050505; /* 白天模式文字 */
        --neutral-white: #222222;
    }

/* 添加过渡效果使切换更平滑 */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 模式切换按钮样式 */
.mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--second-color);
    color: var(--third-color);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

    .mode-toggle:hover {
        transform: scale(1.1);
    }
/* New global box-sizing and body defaults */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Montserrat", sans-serif;
  background-color: var(--main-color);
  color: var(--third-color);
}

/* 2. Header Styles */
h1 {
  color: var(--third-color);
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
  background-color: var(--main-color);
  text-align: center;
  padding-top: 20px;
  padding-bottom: 10px;
  margin: 0; /* normalized from 0cm */
}
.intro {
  font-family: Montserrat, sans-serif;
  color: var(--second-color);
  text-align: center;
  border-bottom: var(--second-color) 0.5px solid;
  padding: 12px;
}
.nav-bar {
  text-decoration: none;
  font-family: Montserrat, sans-serif;
  font-weight: 800;
  color: var(--second-color);
  text-align: center;
  border-bottom: var(--second-color) 0.5px solid;
  padding: 12px;
}

/* nav interactions and accessibility */
.nav-link {
  text-decoration: none;
  color: var(--second-color);
  padding: 8px 20px;
  margin: 0 10px;
  transition: transform 0.18s ease, opacity 0.18s ease,
    border-bottom-color 0.18s ease;
  border-bottom: 3px solid transparent;
  opacity: 0.6;
  outline: none;
  border-radius: 4px;
}
.nav-link:hover,
.nav-link:focus,
.nav-link:active {
  opacity: 1;
  transform: translateY(-2px);
  text-decoration: none;
}
.nav-link:focus-visible {
  box-shadow: 0 0 0 3px rgba(96, 44, 142, 0.18);
}

/* 3. Profile Picture Style */
/* Replace fixed height with responsive sizing and use radius variable */
.profile {
  display: block;
  margin: var(--spacing) auto 0;
  width: 100%;
  max-width: 320px;
  max-height: 320px; /* limit height to avoid very tall images */
  height: auto;
  object-fit: cover; /* crop if needed */
  border-radius: var(--radius);
  border: 2px solid var(--second-color);
  box-shadow: 0 4px 8px rgba(40, 8, 48, 0.345);
}

.pkulogo {
    /* 转为行内块，实现与文字同行不换行 */
    display: inline-block;
    /* 清除默认边框（部分浏览器可能自带） */
    border: none;
    /* 控制图片大小，可根据需求调整 */
    width: 40px;
    height: auto;
    /* 与右侧文字保持间距，避免紧贴 */
    margin-right: 8px;
    /* 与文字垂直居中对齐，视觉更协调 */
    vertical-align: middle;
}
:root.light-mode .pkulogo {
    content: url("image/pku.png"); /* 白天模式专用logo路径 */
}
.tjulogo {
    /* 转为行内块，实现与文字同行不换行 */
    display: inline-block;
    /* 清除默认边框（部分浏览器可能自带） */
    border: none;
    /* 控制图片大小，可根据需求调整 */
    width: 40px;
    height: auto;
    /* 与右侧文字保持间距，避免紧贴 */
    margin-right: 8px;
    /* 与文字垂直居中对齐，视觉更协调 */
    vertical-align: middle;
}

:root.light-mode .tjulogo {
    content: url("image/tju1.png"); /* 白天模式专用logo路径 */
}

/* 4. Quote Style */
.Motto {
  font-family: Montserrat, sans-serif;
  font-size: clamp(1.5rem, 3.2vw, 2.5rem); /* responsive sizing */
  font-weight: 800;
  text-align: center;
  max-width: min(90%, 40rem);
  margin: 20px auto 1px;
  padding: 0 var(--spacing);
}
#Motto-footer {
  font-family: Montserrat, sans-serif;
  font-size: 1rem;
  font-weight: 100;
  text-align: center;
  max-width: min(90%, 40rem);
  margin: 0 auto 40px;
  padding: 0 var(--spacing);
}

/* 5. Main content Style */
.main-content {
  font-family: "Montserrat", sans-serif;
  font-weight: 200;
  color: var(--neutral-white);
  background-color: var(--main-color);
  padding: 0px;
  border-bottom: var(--third-color) 1px solid;
  display: flex;
  flex-direction: row;
  gap: 20px;
  align-items: flex-start;
}

/* Keep existing misspelled class names but add correct aliases so both work */
.left-colomn,
.left-column {
  flex: 1;
  padding: 10px;
  border-right: var(--third-color) 0.5px solid;
}
.right-colomn,
.right-column {
  flex: 1;
  padding: 10px;
}

/* 6. Footer Style */
.footer {
  font-family: "Instrument Sans", sans-serif;
  font-weight: 100;
  color: var(--third-color);
  background-color: var(--main-color);
  text-align: center;
  padding: 6px;
  margin-top: 0px;
}
/* 7. project Style */
/* Make project images responsive and unify rounding */
.card-image {
    overflow: hidden;
    display: block;
    margin: var(--spacing) auto 0;
    width: 100%;
    max-width: 320px; /* 限制最大宽度 */
    /* 关键：设置正方形比例 */
    aspect-ratio: 1 / 1; /* 宽高比1:1 */
    border-radius: var(--radius);
    border: 2px solid var(--second-color);
}
 .card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* 保持比例并裁剪超出部分 */
        object-position: center; /* 从中心裁剪 */
 }

.projects-section {
  font-family: "Montserrat", sans-serif;
  font-weight: 200;
  color: var(--neutral-white);
  background-color: var(--main-color);
  padding: 0px;
  border-bottom: var(--third-color) 1px solid;
  display: flex;
  flex-wrap: wrap; /* ensure wrapping */
  gap: 20px;
  justify-content: flex-start; /* prevent single-line centering behavior */
  align-items: flex-start;
}

.project-card {
  margin: 20px;
  padding: 10px;
  border: var(--third-color) 0.5px solid;
  border-radius: var(--radius);
  box-shadow: 0 4px 8px rgba(40, 8, 48, 0.345);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  flex: 1 1 220px; /* allow shrink/grow, prefer ~220px width */
  max-width: 320px;
  box-sizing: border-box;
  align-items: flex-start;
}


.project-card:hover,
.project-card:focus-within {
  transform: translateY(-6px);
  box-shadow: 0 10px 20px rgba(40, 8, 48, 0.28);
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
    gap: 12px;
  }
  .projects-section {
    justify-content: center;
  }
  .Motto,
  #Motto-footer {
    max-width: 90%;
  }
  /* ensure cards scale well on medium screens */
  .project-card {
    flex: 1 1 45%; /* generally two columns if space permits */
    max-width: 48%;
  }
}

@media (max-width: 480px) {
  .nav-link {
    padding: 6px 10px;
    margin: 0 6px;
  }
  .project-card {
    flex: 1 1 100%;
    max-width: 100%;
    margin: 10px;
  }
}

/* 联系表单样式 */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

    .contact-form label {
        font-weight: 500;
        color: var(--second-color);
    }

    .contact-form input,
    .contact-form textarea {
        padding: 10px;
        border: 1px solid var(--second-color);
        border-radius: var(--radius);
        background-color: rgba(255, 255, 255, 0.1);
        color: var(--third-color);
        font-family: inherit;
    }

    .contact-form button {
        background-color: var(--second-color);
        color: var(--third-color);
        border: none;
        padding: 12px;
        border-radius: var(--radius);
        cursor: pointer;
        transition: background-color 0.3s ease;
        font-weight: 600;
    }

        .contact-form button:hover {
            background-color: #7a3ca8;
        }

/* 联系信息样式 */
.contact-info {
    list-style: none;
    padding: 0;
}

    .contact-info li {
        margin-bottom: 10px;
        padding-left: 20px;
        position: relative;
    }

        .contact-info li:before {
            content: "•";
            color: var(--second-color);
            position: absolute;
            left: 0;
        }

/* 确保当前页面导航高亮 */
.nav-link.active {
    opacity: 1;
    border-bottom: 3px solid var(--second-color);
}


/* 个人照片悬停动画效果 */
.profile {
    transition: all 0.5s ease; /* 平滑过渡所有属性变化 */
    transform-origin: center center; /* 以中心为变换原点 */
}

    .profile:hover {
        transform: scale(1.05) rotate(1deg); /* 轻微放大并旋转 */
        box-shadow: 0 8px 16px rgba(96, 44, 142, 0.4); /* 增强阴影 */
        border-color: #9b59b6; /* 边框颜色变化 */
    }

/* 导航链接增强效果 */
.nav-link {
    transition: all 0.3s ease; /* 延长过渡时间使动画更流畅 */
    position: relative; /* 为伪元素定位 */
}

    .nav-link:hover {
        color: #9b59b6; /* 悬停时颜色变化 */
    }

    .nav-link:active {
        transform: translateY(1px); /* 点击时轻微下移 */
    }

    /* 为链接添加下划线动画效果 */
    .nav-link::after {
        content: '';
        position: absolute;
        width: 0;
        height: 2px;
        bottom: 0;
        left: 0;
        background-color: #9b59b6;
        transition: width 0.3s ease;
    }

    .nav-link:hover::after {
        width: 100%; /* 悬停时下划线展开 */
    }

/* 项目卡片增强效果 */
.project-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* 使用贝塞尔曲线使动画更自然 */
}

    .project-card:active {
        transform: translateY(2px); /* 点击时下移 */
        box-shadow: 0 2px 4px rgba(40, 8, 48, 0.3); /* 点击时阴影变小 */
    }

/* 联系表单按钮增强效果 */
.submit-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

    .submit-btn:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
    }

    .submit-btn:active:not(:disabled) {
        transform: translateY(0);
        box-shadow: none;
    }

    /* 按钮点击波纹效果 */
    .submit-btn::after {
        content: '';
        display: block;
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        pointer-events: none;
        background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
        background-repeat: no-repeat;
        background-position: 50%;
        transform: scale(10, 10);
        opacity: 0;
        transition: transform 0.5s, opacity 0.3s;
    }

    .submit-btn:active:not(:disabled)::after {
        transform: scale(0, 0);
        opacity: 0.3;
        transition: 0s;
    }

/* 为所有链接添加统一的激活状态 */
a:active {
    color: #9b59b6;
}

/* 在现有样式中添加或修改 */
.picture-motto {
    text-align: center; /* 确保内容居中对齐 */
    margin: 20px 0; /* 可选：添加上下间距 */
}