/* ============================================
   assets/css/style.css
   INFIAITE Portfolio
   设计方向：中性为主，蓝色只做点缀
   ============================================ */

/* ---------- 设计令牌 ---------- */
:root {
    /* 强调色：只用在按钮、链接 hover、导航指示、焦点环 */
    --primary: #0057cc;
    --primary-hover: #0044a3;
    --primary-soft: #e8f0fd;

    /* 中性色阶 */
    --ink: #0f172a;     /* 标题 / 品牌名 */
    --ink-2: #334155;   /* 正文 */
    --muted: #5b6b80;   /* 说明文字 / 元信息（浅灰底上 5.11:1，满足 AA） */
    --line: #e2e8f0;    /* 分割线 / 卡片边框 */
    --surface: #ffffff;
    --surface-2: #f6f8fb;
    --pill: #f1f5f9;

    --radius-sm: 8px;
    --radius-md: 12px;

    --header-h: 64px; /* JS 按实测 header 高度覆盖 */
}

/* ---------- 基础重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-y: scroll;
    color: var(--ink-2);
    background-color: var(--surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 尊重系统「减少动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- 头部导航 ---------- */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}

nav a:hover {
    color: var(--ink);
}

nav a.active {
    color: var(--ink);
}

nav a.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary);
    border-radius: 2px;
}

/* ---------- 通用 section 布局 ---------- */
section {
    min-height: 100vh;
    min-height: 100svh; /* 移动端浏览器工具栏会吃掉 vh，用 svh 更稳 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 6rem 2rem 2rem;
    position: relative;
}

.section-content {
    max-width: 1200px;
    width: 100%;
}

/* ---------- 各区块背景色 ---------- */
#about {
    background-color: var(--surface);
}

#projects {
    background-color: var(--surface-2);
}

/* ---------- 标题与文字 ---------- */
h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin-bottom: 1rem;
    color: var(--ink);
}

h2 {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 2rem 0 0.875rem;
}

p {
    line-height: 1.7;
}

/* 区块导语 */
.section-content > p,
.projects-archive > p {
    font-size: 1.0625rem;
    color: var(--muted);
    margin-bottom: 2.5rem;
    max-width: 60ch;
}

/* ---------- 关于我：网格 ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1.8fr;
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
    margin-top: 2.5rem;
}

/* ---------- Logo ---------- */
.profile-img {
    width: 180px;
    height: 180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

@media (min-width: 640px) {
    .profile-img { width: 220px; height: 220px; }
}

@media (min-width: 960px) {
    .profile-img { width: 260px; height: 260px; }
}

/* ---------- About 文案 ---------- */
.about-infiaite__intro,
.about-infiaite__story,
.about-infiaite__cta {
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--ink-2);
    margin-bottom: 1.125rem;
    max-width: 62ch;
}

.about-infiaite__intro strong,
.about-infiaite__story strong,
.about-infiaite__cta strong {
    color: var(--ink);
    font-weight: 600;
}

.cta-actions {
    display: inline;
    color: var(--primary);
    font-weight: 500;
}

/* ---------- 标签（技能 / 项目 统一一套） ---------- */
.skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skill-tag,
.project-tag {
    background-color: var(--pill);
    color: var(--ink-2);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    line-height: 1.4;
    white-space: nowrap;
}

/* ---------- 项目网格与卡片 ---------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.75rem;
    margin-top: 2rem;
}

.project-card {
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease,
                border-color 0.25s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.project-img {
    aspect-ratio: 3 / 2;   /* 素材全部是 600x400，不再被裁掉 20% */
    width: 100%;
    background-color: #eef2f6;
    overflow: hidden;
}

.project-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.project-card:hover .project-img img {
    transform: scale(1.03);
}

.project-info {
    padding: 1.25rem 1.5rem 1.5rem;
}

.project-title {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.project-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.project-title a:hover,
.project-title a:focus {
    color: var(--primary);
}

.project-info p {
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--muted);
    margin-bottom: 0;
}

.project-link {
    color: inherit;
    text-decoration: none;
    display: block;
}

.project-link:focus-visible,
.project-title a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* 首页 View All 按钮 */
.projects-more {
    text-align: center;
    margin-top: 3rem;
}

.view-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--primary);
    color: #ffffff;
    text-decoration: none;
    border: none;
    padding: 0.75rem 1.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.view-more-btn:hover {
    background-color: var(--primary-hover);
}

/* 独立项目列表页 */
.projects-archive {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8rem 2rem 4rem;
}

.projects-archive h1 {
    margin-bottom: 0.5rem;
}

.projects-archive__back {
    text-align: center;
    margin-top: 3rem;
}

/* ---------- 移动端菜单切换按钮 ---------- */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.menu-toggle span {
    height: 3px;
    width: 100%;
    background-color: var(--ink);
    border-radius: 3px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

/* 展开时汉堡变 X（21px 高 / 3px 条 → 上下各移 9px） */
.menu-toggle.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

.menu-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .menu-toggle { display: flex; }

    nav ul {
        position: fixed;
        top: var(--header-h); /* JS 按实测 header 高度写入，不再硬编码 60px */
        left: 0;
        width: 100%;
        flex-direction: column;
        background-color: var(--surface);
        border-bottom: 1px solid var(--line);
        padding: 1.5rem 2rem;
        gap: 1.25rem;
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;   /* 收起时键盘/读屏也不可达 */
        pointer-events: none;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
        z-index: 999;
    }

    nav.active ul {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .about-grid { grid-template-columns: 1fr; }

    section { padding: 5rem 1rem 2.5rem; }
    .projects-archive { padding: 7rem 1rem 3rem; }
}

/* ============================================
   页脚 / Contact 区域
   ============================================ */

#contact.footer-section {
    min-height: auto !important;      /* 高度由内容自然撑开 */
    justify-content: flex-start !important;
    padding: 5rem 2rem 0 !important;
    background-color: var(--surface);
    display: flex;
    flex-direction: column;
    position: relative;
}

.footer-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 3.5rem;
}

.footer-columns {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand {
    color: var(--ink);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 0.875rem;
}

.footer-desc {
    color: var(--muted);
    font-size: 0.9375rem;
    line-height: 1.75;
    max-width: 42ch;
}

.footer-heading {
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.625rem;
}

.footer-links a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
    font-size: 0.9375rem;
}

.footer-links a:hover {
    color: var(--primary);
}

.wechat-qr img {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    object-fit: cover;
}

.footer-contact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-contact a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.2s ease;
}

.footer-contact a:hover {
    color: var(--primary);
}

.contact-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    background-color: var(--primary-soft);
    color: var(--primary);
    border-radius: var(--radius-sm);
}

/* 底部版权条：浅色 + 细分割线（原来是整条高饱和蓝） */
.footer-bottom {
    margin-left: -2rem;
    margin-right: -2rem;
    width: calc(100% + 4rem);
    border-top: 1px solid var(--line);
    padding: 1.5rem 2rem;
    text-align: center;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
}

/* 响应式 */
@media (max-width: 992px) {
    .footer-columns {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    #contact.footer-section {
        padding: 3rem 1rem 0 !important;
    }

    .footer-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-container {
        padding-bottom: 2rem;
    }

    .footer-bottom {
        margin-left: -1rem;
        margin-right: -1rem;
        width: calc(100% + 2rem);
        padding: 1.25rem 1rem;
    }
}
