/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg: #ffffff;
    --color-text: #000000;
    --color-text-light: #999999;
    --font-sans: 'Corbel', 'Segoe UI', 'Arial', sans-serif;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 6rem 3rem 2rem;
    transition: transform 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.header.hidden {
    transform: translateY(-100%);
}

.name {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.15em;
}

a.name {
    text-decoration: none;
    color: #000000;
}

a.name:hover {
    opacity: 0.7;
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: #000000;
    white-space: nowrap;
    text-align: right;
    margin-right: 2rem;
}

/* ===== Main Content Layout ===== */
.main-content {
    padding: 18rem 3rem 3rem;
}

/* ===== Section Title ===== */
.section-title {
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
}

/* ===== Projects Section (Photo Masonry) ===== */
.projects-section {
    margin-bottom: 6rem;
}

.projects-section .masonry {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* ===== Articles Section ===== */
.articles-section {
    margin-bottom: 3rem;
}

.articles-section .masonry {
    column-count: 5;
    column-gap: 1.5rem;
}

/* ===== Photo Masonry Base ===== */
.masonry {
    column-gap: 1.5rem;
}

/* Projects use grid layout (left-to-right, then top-to-bottom) */
.projects-section .masonry {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Articles use grid layout for strict reverse order (right-to-left, bottom-to-top) */
.articles-section .masonry {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-flow: column-reverse;
    gap: 1.5rem;
    align-items: start;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    cursor: pointer;
    align-self: start;
}

/* For grid layout, remove margin-bottom as gap handles spacing */
.projects-section .masonry .masonry-item,
.articles-section .masonry .masonry-item {
    margin-bottom: 0;
}

/* Article images maintain 600:470 aspect ratio */
.articles-section .photo-placeholder {
    aspect-ratio: 600 / 470;
}

.articles-section .photo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Photo Card with Hover Overlay ===== */
.photo-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.photo-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: transparent;
    overflow: hidden;
    position: relative;
    transition: transform 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.photo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.02);
}

/* First item (portrait photo) special styling */
.masonry-item:first-child .photo-placeholder {
    background: transparent;
}

/* ===== Photo Overlay (Hover Info) ===== */
.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.4s ease;
    pointer-events: none;
}

.photo-overlay h3 {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    letter-spacing: 0.05em;
}

.photo-overlay p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.05em;
}

.masonry-item:hover .photo-overlay {
    transform: translateY(0);
}

/* ===== Flip Animation ===== */
.masonry-item.flipping .photo-card {
    animation: flipCard 0.6s ease forwards;
}

@keyframes flipCard {
    0% {
        transform: perspective(1000px) rotateY(0deg);
    }
    50% {
        transform: perspective(1000px) rotateY(90deg);
    }
    100% {
        transform: perspective(1000px) rotateY(180deg);
    }
}

/* ===== Article Card ===== */

.article-card {
    display: block;
    break-inside: avoid;
    margin-bottom: 1.5rem;
    padding: 2rem;
    background: #fafafa;
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.3s ease, transform 0.3s ease;
}

.article-card:hover {
    background: #f0f0f0;
    transform: translateX(5px);
}

.article-card h2 {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.article-meta {
    font-size: 0.75rem;
    color: var(--color-text-light);
    letter-spacing: 0.1em;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .main-content {
        padding: 16rem 2rem 2rem;
    }

    .projects-section .masonry {
        grid-template-columns: repeat(2, 1fr);
    }

    .articles-section .masonry {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 4rem 2rem 1.5rem;
    }

    .name {
        font-size: 1rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .main-content {
        padding: 14rem 1.5rem 1.5rem;
    }

    .projects-section .masonry {
        grid-template-columns: 1fr;
    }

    .articles-section .masonry {
        column-count: 1;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 3rem 1.5rem 1.2rem;
    }

    .main-content {
        padding: 12rem 1rem 1rem;
    }
}

/* ===== Project Detail Page ===== */
.project-detail {
    padding: 12rem 3rem 3rem;
    max-width: 1000px;
    margin: 0 auto;
}

.project-header {
    margin-bottom: 2rem;
}

.project-title {
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.project-year {
    font-size: 1.0rem;
    font-weight: 400;
    color: var(--color-text-light);
    letter-spacing: 0.1em;
}

.project-design-points {
    margin-bottom: 3rem;
    max-width: 800px;
}

.project-design-points p {
    font-size: 1.0rem;
    line-height: 1.8;
    color: #333;
    font-weight: 300; /* 细体 */
    margin-bottom: 0.2rem; /* 组内段落间距小一点 */
}

.paragraph-group {
    margin-bottom: 1.5rem; /* 组之间间距大一点 */
}

.paragraph-group p:last-child {
    margin-bottom: 0; /* 组内最后一个段落没有底部间距 */
}

.project-design-points a {
    color: #333; /* 链接颜色跟内容一样 */
    text-decoration: underline; /* 保持下划线，或者去掉也可以，用户没说，我先保持 */
    font-weight: 300; /* 链接也是细体 */
}

.project-design-points a:hover {
    opacity: 0.7; /* 悬停时稍微透明 */
}

/* ===== Project Bio Section ===== */
.project-bio-section {
    display: flex;
    gap: 3rem;
    margin-bottom: 3rem;
}

.project-bio-text {
    flex: 2;
}

.project-bio-text p {
    font-size: 1.0rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 1.2rem;
}

.project-fullwidth-image {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 2rem;
}

.project-bio-portrait {
    flex: 1;
}

.portrait-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.project-awards {
    margin-bottom: 3rem;
}

.project-awards h3 {
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.project-awards ul {
    list-style: none;
    padding: 0;
}

.project-awards li {
    font-size: 1.0rem;
    line-height: 1.8;
    color: #333;
    padding-left: 1rem;
    position: relative;
}

.project-awards li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--color-text-light);
}

.project-gallery-large {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 3rem;
}

.gallery-image {
    width: 100%;
    height: auto;
    display: block;
    background: #f0f0f0;
    aspect-ratio: auto;
    object-fit: contain;
}

.gallery-video {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.back-link {
    display: inline-block;
    font-family: Corbel, "Segoe UI", Arial, sans-serif;
    font-size: 1.0rem;
    font-weight: 300;
    color: #333;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: opacity 0.3s ease;
}

.back-link:hover {
    opacity: 0.6;
}

/* ===== Article Detail Page ===== */
.article-detail {
    padding: 12rem 3rem 3rem;
    max-width: 800px;
    margin: 0 auto;
    font-family: "Microsoft YaHei", "SimHei", "PingFang SC", "Heiti SC", sans-serif;
}

.article-detail h1,
.article-detail h2,
.article-detail h3,
.article-detail .lead,
.article-detail p,
.article-detail .article-references,
.article-detail .article-source,
.article-detail figcaption {
    font-family: "Microsoft YaHei", "SimHei", "PingFang SC", "Heiti SC", sans-serif;
}

.article-header {
    margin-bottom: 3rem;
}

.article-header h1 {
    font-size: 1.6rem;
    font-weight: 300;
    line-height: 1.4;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
    color: #333;
}

.article-meta-detail {
    display: flex;
    gap: 2rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
    letter-spacing: 0.1em;
}

.article-body {
    line-height: 1.9;
}

.article-body .lead {
    font-size: 1rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 2.5rem;
    font-weight: 300;
}

.article-body h2 {
    font-size: 1.2rem;
    font-weight: 300;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    letter-spacing: 0.03em;
    color: #333;
}

.article-body h3 {
    font-size: 1.2rem;
    font-weight: 300;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #333;
}

.article-body p {
    font-size: 1rem;
    line-height: 1.9;
    margin-bottom: 1.5rem;
    color: #333;
    font-weight: 300;
}

.article-figure {
    margin: 3rem 0;
    text-align: center;
}

.article-figure img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 0.75rem;
}

.article-figure figcaption {
    font-size: 0.8rem;
    color: var(--color-text-light);
    letter-spacing: 0.05em;
    font-style: italic;
    font-weight: 300;
}

.article-header h1 {
    padding-top: 5px;
}

.article-references {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin: 3rem 0;
    padding: 2rem 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.article-references p {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.article-references p:last-child {
    margin-bottom: 0;
}

.article-references a {
    color: var(--color-text-light);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.article-references a:hover {
    opacity: 0.7;
}

.article-source {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--color-text-light);
    font-weight: 300;
}

.article-source p {
    font-weight: 300;
}

.article-source a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 4px;
    font-weight: 300;
}

.article-source a:hover {
    opacity: 0.7;
}

.article-body .note {
    font-size: 1rem;
    line-height: 1.9;
    margin-bottom: 3rem; /* 两个回车键的距离 */
    color: var(--color-text-light); /* 浅灰色，跟标题下面小字一样 */
    font-weight: 300;
}

/* ===== Responsive for Detail Pages ===== */
@media (max-width: 768px) {
    .project-detail,
    .article-detail {
        padding: 6rem 2rem 2rem;
    }

    .project-header h1 {
        font-size: 2rem;
    }

    .article-header h1 {
        font-size: 1.8rem;
    }

    .project-gallery {
        grid-template-columns: 1fr;
    }

    .project-bio-section {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .project-detail,
    .article-detail {
        padding: 5rem 1.5rem 1.5rem;
    }

    .project-meta,
    .article-meta-detail {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ===== Media & Awards Section ===== */
.media-section {
    padding: 6rem 0;
}

.media-content {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.media-category {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-title {
    font-size: 1rem;
    font-weight: 400; /* 正常字体 */
    margin: 0;
    padding: 0;
    letter-spacing: 0.02em;
}

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

.category-list li {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    font-weight: 300; /* 细体 */
}

.category-list a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 4px;
    font-weight: 300;
}

.category-list a:hover {
    opacity: 0.7;
}

/* ===== Contact Section ===== */
.contact-section {
    padding: 6rem 0;
    padding-bottom: 8rem;
}

.contact-email {
    font-size: 0.9rem;
    margin-bottom: 2rem;
    letter-spacing: 0.02em;
}

.contact-links {
    display: flex;
    gap: 2rem;
}

.contact-link {
    font-size: 0.9rem;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: 0.05em;
    position: relative;
}

.contact-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-text);
    transition: width 0.3s ease;
}

.contact-link:hover::after {
    width: 100%;
}
