* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    scroll-behavior: smooth;
}

header {
    position: fixed;
    top: 0;
    width: 100%;
    background: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
}

.logo {
    margin-left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo img {
    height: 50px;
}

.site-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

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

nav ul li {
    margin-left: 2rem;
}

nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

.hero {
    height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('/images/bg.webp');
    background-size: cover;
    background-position: center;
    color: white;
    margin-top: 70px;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.hero .intro {
    max-width: 800px;
    line-height: 1.8;
}

section {
    padding: 24px 2rem;
}

.works-right, .works-left {
    height: auto;
    margin-bottom: 24px;
}

.content {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    min-height: 300px;
}

.images {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
    width: auto;
}

.images img {
    width: 300px;
    height: 266px;
    border-radius: 10px;
    object-fit: cover;
    object-position: top;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.hobbies {
    height: auto;
    margin: 24px 0;
}

.hobby-cards {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.card {
    flex: 1;
    text-align: left;
}

.card img {
    width: 100%;
    height: 200px;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 1rem;
}

.card p {
    padding: 0 10px;
    text-align: left;
}

.about {
    height: auto;
    margin: 24px 0;
}

.about img {
    width: 400px;
    height: 300px;
    border-radius: 10px;
    object-fit: cover;
}

.about .content {
    min-height: 300px;
}

.contact {
    height: auto;
    max-width: 250px;
    margin: 0 auto 24px;
    text-align: center;
}

.contact::before,
.contact::after {
    display: none;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

.social-links img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    pointer-events: none;
}

.social-links a {
    display: inline-block;
    transition: transform 0.3s ease;
}

.social-links a:hover {
    transform: scale(1.1);
}

.social-links img,
.beian img {
    cursor: default;
}

footer {
    text-align: center;
    padding: 1rem;
    background: #f5f5f5;
}

footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.beian {
    display: flex;
    align-items: center;
    gap: 5px;
}

.beian img {
    height: 1.2em;  /* 与文字等高 */
    width: auto;
    margin-right: 3px;
}

footer a {
    color: #666;
    text-decoration: none;
}

/* 图片悬停效果 */
.images img:hover,
.card img:hover,
.about img:hover {
    transform: scale(1.05);
}

/* 除了 logo 以外的所有图片添加过渡效果 */
img:not(.logo img) {
    transition: transform 0.3s ease;
    cursor: pointer;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    cursor: pointer;
}

.modal img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
}

.works-right p,
.works-left p {
    flex: 1;
    text-align: left;
    margin: 0;
}

section h2 {
    margin-bottom: 2rem;
}

.menu-btn {
    display: none;
    cursor: pointer;
    padding: 5px;
}

.menu-btn img {
    width: 24px;
    height: 24px;
}

@media screen and (max-width: 768px) {
    .menu-btn {
        display: block;
        z-index: 1001;
    }

    nav {
        position: fixed;
        top: -100%;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        background: white;
        padding: 60px 0 20px;
        transition: top 0.3s ease;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    nav.active {
        top: 0;
        right: 0;
    }

    nav ul {
        flex-direction: column;
        align-items: flex-start;
    }

    nav ul li {
        margin: 1rem;
        width: 100%;
    }

    nav ul li a {
        display: block;
        padding: 0.5rem;
    }

    .site-title {
        display: block;
        font-size: 1.2rem;
    }

    .hero {
        height: auto;
        min-height: 400px;
        padding: 4rem 1rem;
        margin-top: 60px;
    }

    .content {
        flex-direction: column;
        min-height: auto;
        gap: 1rem;
    }

    .images {
        flex-direction: column;
        width: 100%;
    }

    .images img {
        width: 100%;
        height: 200px;
        margin-bottom: 1rem;
    }

    .works-right .content,
    .works-left .content {
        flex-direction: column;
    }

    .works-left .content {
        flex-direction: column-reverse;
    }

    .works-right p,
    .works-left p {
        width: 100%;
        margin: 1rem 0;
    }

    .hobby-cards {
        flex-direction: column;
        gap: 1rem;
    }

    .card {
        width: 100%;
        margin-bottom: 1rem;
    }

    .card img {
        height: 200px;
    }

    .about .content {
        flex-direction: column;
        align-items: center;
    }

    .about img {
        width: 100%;
        height: auto;
        max-width: 300px;
        margin-bottom: 1rem;
    }

    .social-links {
        gap: 2rem;
    }

    .social-links img {
        width: 24px;
        height: 24px;
    }

    section {
        padding: 24px 1rem;
        overflow: hidden;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero h2 {
        font-size: 1.2rem;
    }

    .hero .intro {
        font-size: 0.9rem;
    }

    footer p {
        flex-direction: row;
        gap: 0.5rem;
        font-size: 12px;
        white-space: nowrap;
    }

    footer {
        padding: 0.5rem;
        overflow-x: auto;
    }

    .beian {
        font-size: 12px;
    }

    /* 最后一个作品的布局调整 */
    .works-left:last-of-type .content {
        flex-direction: column !important;
    }

    .works-left:last-of-type .content p {
        order: 2;
    }

    .works-left:last-of-type .content .images {
        order: 1;
    }
}

@media screen and (max-width: 480px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero h2 {
        font-size: 1rem;
    }

    nav ul li {
        margin-left: 0.5rem;
    }

    nav ul li a {
        font-size: 12px;
    }
}

#works, #contact {
    scroll-margin-top: 80px;
}

/* iOS 深色模式适配 */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    /* 仅在 iOS 设备上应用 */
    @supports (-webkit-touch-callout: none) {
        header {
            background: #1c1c1e;
        }

        nav {
            background: #1c1c1e;
        }

        nav ul li a {
            color: #ffffff;
        }

        .site-title {
            color: #ffffff;
        }

        .works-right p,
        .works-left p,
        .card p,
        .about p {
            color: #ffffff;
        }

        section h2 {
            color: #ffffff;
        }

        footer {
            background: #1c1c1e;
        }

        footer a,
        .beian a {
            color: #8e8e93;
        }

        /* 菜单背景 */
        nav.active {
            background: #1c1c1e;
        }

        /* 内容区域背景 */
        .content {
            background: transparent;
        }

        /* 卡片背景 */
        .card {
            background: #2c2c2e;
        }

        /* 模态框背景 */
        .modal {
            background-color: rgba(0, 0, 0, 0.95);
        }

        /* 整体背景色 */
        body {
            background: #000000;
            color: #ffffff;
        }
    }
}

/* 修改懒加载样式 */
.lazy {
    opacity: 0;
    transition: opacity 0.5s ease-in;
    min-height: 100px; /* 添加最小高度 */
    background: #f0f0f0; /* 添加占位背景色 */
}

.lazy.loaded {
    opacity: 1;
}

/* 移除之前的 ::after 伪元素，改用背景色作为占位 */
img.lazy:not([src]) {
    background: #f0f0f0;
}

/* 添加页面加载动画样式 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loader-content {
    text-align: center;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.loader-text {
    color: #333;
    font-size: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* iOS深色模式适配加载动画 */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    @supports (-webkit-touch-callout: none) {
        .page-loader {
            background: #000000;
        }
        
        .loader-spinner {
            border: 3px solid #333;
            border-top: 3px solid #fff;
        }

        .loader-text {
            color: #ffffff;
        }
    }
}

/* 页面内容初始状态 */
body > *:not(.page-loader) {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* 页面加载完成后的状态 */
body.loaded > *:not(.page-loader) {
    opacity: 1;
}

.intro {
    max-width: 800px;
    line-height: 1.8;
}

.intro small {
    display: block;
    margin-top: 1rem;
    font-size: 0.9em;
    opacity: 0.8;
}

#hitokoto_text {
    font-size: 1.2em;
    font-weight: 300;
}

#hitokoto_from {
    font-style: italic;
}

/* 添加作品标题样式 */
.works-right p strong,
.works-left p strong {
    display: block;
    font-size: 1.2em;
    margin-bottom: 1rem;
} 