:root {
    --bg-color: #f7f7f7;
    --text-color: #000000;
    --text-secondary: #878787;
    --border-color: #E5E7EB;
    --card-shadow: rgba(0,0,0,0.04);
    --card-shadow-hover: rgba(0,0,0,0.12);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --text-secondary: #9e9e9e;
    --border-color: #2a2a2a;
    --card-shadow: rgba(0,0,0,0.2);
    --card-shadow-hover: rgba(0,0,0,0.4);
}

*, *::before, *::after {
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;  /* 确保所有元素都使用 Inter */
}


html, body {
    margin: 0;
    padding: 0;
}

/* Fullpage home: lock viewport */
body.fullpage {
    overflow: hidden;
    height: 100%;
}

/* Page transition animation */
@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Fullpage scroll wrapper */
.sections-wrapper {
    will-change: transform;
    transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}


.section {
    display: flex;
    align-items: center;
    padding-top: 60px;
    padding-bottom: 0;
    position: relative;
}

/* Sub-pages: center all content as one block */
body:not(.fullpage) {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 60px;
}

body:not(.fullpage) .section {
    padding-top: 0;
}

body:not(.fullpage) .section + .section {
    padding-top: 24px;
}

/* Fullpage home: fixed height sections */
.fullpage .section {
    height: 100vh;
    min-height: unset;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Section content entrance/exit animation (fullpage home only) */
.fullpage .section > * {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fullpage .section.section-active > * {
    opacity: 1;
    transition: opacity 0.5s ease 0.25s;
}

/* Nav active state */
.nav-button.nav-active {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Projects section: vertically centered */
#projects {
    align-items: center;
}

.section-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background-color: var(--bg-color);
    padding-top: 32px;
    padding-bottom: 20px;
    transition: background-color 0.3s ease;
}


.container {
    margin: 0 160px;
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

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

.nav-container {
    display: flex;
    gap: 32px;
    justify-content: flex-start;
    width: 100%;
}

.nav-button {
    background-color: transparent;
    width: fit-content; 
    height: fit-content;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;  /* Remove link underline */
    color: inherit;  /* Inherit text color */
    cursor: pointer;  /* Pointer cursor style */
}

.nav-button:hover {
    text-decoration: underline;
}

.nav-font {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.04em;
}

.theme-toggle {
    background: transparent;
    border: none;
    margin-left: auto;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.04em;
    color: inherit;
    padding: 0;
    line-height: 1;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle:hover {
    opacity: 0.6;
}


.hero {
    display: flex;
    flex-direction: column;  
    gap: 20px;  
}

/* Project page: main title and right caption on same line, aligned */
.hero-title-row {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.hero-title {
    font-size: 36px;
    font-weight: 550;  /* semi-bold */
    letter-spacing: -0.04em;
    margin: 0;  /* Remove default margin */
}

/* Cormorant Garamond serif font for index page hero title only */
body.fullpage .hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 44px;
}

.hero-caption {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: -0.04em;
    margin: 0;
    flex-shrink: 0;
}

.hero-subtitle {
    font-size: 20px;
    font-weight: 400;
    margin: 0;  /* Remove default margin */
    letter-spacing: -0.04em;
}

.hover-word-cycle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border-radius: 0.3em;
    white-space: nowrap;
    overflow: hidden;
    transition: background-color 0.2s ease, color 0.2s ease, font-weight 0.2s ease, box-shadow 0.2s ease;
}

/* Active state — toggled by JS via .cycling class */
.hover-word-cycle.cycling {
    padding: 0 0.12em;
    background-color: #2b7cff;
    color: transparent;
    font-weight: 700;
    box-shadow: 0 0 0 1px rgba(43, 124, 255, 0.18), 0 6px 14px rgba(43, 124, 255, 0.28);
    background-image: linear-gradient(115deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.28) 50%, rgba(255,255,255,0.1) 100%);
    background-size: 240% 100%;
    animation: hoverWordGlow 3s ease-in-out infinite, hoverWordShimmer 3.3s linear infinite;
    transition: width 0.3s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* Overlay span created by JS */
.hover-word-cycle .cycle-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Fade-out class for word transitions */
.hover-word-cycle .cycle-text.fade-out {
    opacity: 0.3;
    transform: translateY(-0.06em) scale(0.97);
    filter: blur(0.8px);
}

@keyframes hoverWordGlow {
    0%, 100% {
        box-shadow: 0 0 0 1px rgba(43, 124, 255, 0.18), 0 6px 14px rgba(43, 124, 255, 0.28);
    }
    50% {
        box-shadow: 0 0 0 1px rgba(43, 124, 255, 0.28), 0 8px 20px rgba(43, 124, 255, 0.38);
    }
}

@keyframes hoverWordShimmer {
    from {
        background-position: 0% 50%;
    }
    to {
        background-position: 100% 50%;
    }
}

.hero-text {
    font-size: 16px;
    font-weight: 300;
    margin: 0;  /* Remove default margin */
    line-height: 1.5;
    letter-spacing: -0.04em;
}

.project-container {
    display: grid;
    gap: 16px;
    width: 100%; 
}

/* Container with featured and featured-secondary cards: 7:5 ratio */
.project-container:has(.project-card-featured) {
    grid-template-columns: 7fr 5fr;
}

/* Container with three normal cards: equal thirds */
.project-container:has(.project-card-normal):not(:has(.project-card-featured)) {
    grid-template-columns: repeat(3, 1fr);
}

.project-card-featured {
    display: flex;
    flex-direction: column;  
    height: 260px;
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 16px;
    justify-content: flex-start;
    gap: 8px;
    text-decoration: none;  /* Remove link underline */
    color: inherit;  /* Inherit text color */
    cursor: pointer;  /* Pointer cursor style */
    transition: transform 0.3s ease, box-shadow 0.3s ease;  /* Add transition effect */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--card-shadow);
}

/* Use pseudo-element for smooth background image transition */
.project-card-featured::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--hover-bg-image, url('path/to/your/image.jpg'));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 16px;
    z-index: 0;
}

.project-card-featured:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--card-shadow-hover);
}

.project-card-featured:hover::before {
    opacity: 1;
}

.project-card-featured .card-title,
.project-card-featured .card-subtitle {
    position: relative;
    z-index: 1;  /* Ensure text is above overlay */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.project-card-featured:hover .card-title {
    transform: translateY(-2px);
}

.project-card-featured:hover .card-subtitle {
    opacity: 0.9;
}

.project-card-featured-secondary {
    display: flex;
    height: 260px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    justify-content: flex-start;
    gap: 8px;
    flex-direction: column;
    text-decoration: none;  /* Remove link underline */
    color: inherit;  /* Inherit text color */
    cursor: pointer;  /* Pointer cursor style */
    transition: transform 0.3s ease, box-shadow 0.3s ease;  /* Add transition effect */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--card-shadow);
}

/* Use pseudo-element for smooth background image transition */
.project-card-featured-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--hover-bg-image, url('path/to/your/image.jpg'));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 16px;
    z-index: 0;
}

.project-card-featured-secondary:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--card-shadow-hover);
}

.project-card-featured-secondary:hover::before {
    opacity: 1;
}

.project-card-featured-secondary .card-title,
.project-card-featured-secondary .card-subtitle {
    position: relative;
    z-index: 1;  /* Ensure text is above overlay */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.project-card-featured-secondary:hover .card-title {
    transform: translateY(-2px);
}

.project-card-featured-secondary:hover .card-subtitle {
    opacity: 0.9;
}


.project-card-normal {
    display: flex;
    height: 260px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    justify-content: flex-start;
    gap: 8px;
    flex-direction: column;
    text-decoration: none;  /* Remove link underline */
    color: inherit;  /* Inherit text color */
    cursor: pointer;  /* Pointer cursor style */
    transition: transform 0.3s ease, box-shadow 0.3s ease;  /* Add transition effect */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--card-shadow);
}

/* Use pseudo-element for smooth background image transition */
.project-card-normal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--hover-bg-image, url('path/to/your/image.jpg'));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 16px;
    z-index: 0;
}

.project-card-normal:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--card-shadow-hover);
}

.project-card-normal:hover::before {
    opacity: 1;
}

.project-card-normal .card-title,
.project-card-normal .card-subtitle {
    position: relative;
    z-index: 1;  /* Ensure text is above overlay */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.project-card-normal:hover .card-title {
    transform: translateY(-2px);
}

.project-card-normal:hover .card-subtitle {
    opacity: 0.9;
}


.project-card-gap {
    height: 16px;
}

.project-title {
    font-size: 20px;
    font-weight: 400;
    margin: 0;  
    letter-spacing: -0.04em;
}

.card-title {
    font-size: 16px;
    font-weight: 400;
    margin: 0;   
}

.card-subtitle {
    font-size: 14px;
    font-weight: 300;
    margin: 0;
    color: var(--text-secondary);
}

.connect-title {
    font-size: 20px;
    font-weight: 500;
    margin: 0;
}

.connect-logo {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    flex-shrink: 0;
}

.connect-logo svg {
    width: 100%;
    height: 100%;
}

.connnect-text {
    font-size: 16px;
    font-weight: 300;
}

.connect-button {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    align-items: center;
    text-decoration: none;  /* Remove link underline */
    color: inherit;  /* Inherit text color */
    cursor: pointer;  /* Pointer cursor style */
}

.connect-container {
    display: flex;
    gap: 16px;
    flex-direction: column;
}

.footer-container {
    display: flex;
    justify-content: center;
}

.footer-text {
    font-size: 14px;
    font-weight: 300;
    margin: 0;
    color: var(--text-secondary);
}

/* Contact section: column layout with footer at bottom */
#contact {
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

#contact .connect-container {
    flex: 1;
    justify-content: center;
    align-items: flex-start;
}

#contact .footer-text {
    padding-bottom: 20px;
    text-align: center;
    width: 100%;
}

.link-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: flex-start;
    align-items: flex-start;
}

.link-title {
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.04em;
    color: var(--text-color);
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    margin-bottom: 6px;
    line-height: 1.2;
}


.link-item-logo {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    flex-shrink: 0;
}

.link-item {
    display: flex;
    gap: 12px;
    justify-content: flex-start; 
    align-items: center;
    text-decoration: none;  /* Prevent underline on the link container itself */
}

.link-item:link,
.link-item:visited {
    text-decoration: none; /* Remove underline by default */
}
.link-item {
    position: relative;
    display: inline-flex;
}

.link-item-text {
    position: relative; /* Ensure ::after is relative to text only */
}

.link-item-text::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background: #000;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s cubic-bezier(.4,0,.2,1);
    pointer-events: none;
}

.link-item-text:hover::after,
.link-item-text:focus::after {
    transform: scaleX(1);
}

.link-item-logo svg {
    width: 100%;
    height: 100%;
}

.link-icon-canva {
    background: #000;
    border-radius: 4px;
}
.link-icon-canva rect {
    fill: #000;
}
.link-icon-canva path {
    stroke: #fff;
}
[data-theme="dark"] .link-icon-canva {
    background: var(--text-color);
}
[data-theme="dark"] .link-icon-canva rect {
    fill: var(--text-color);
}
[data-theme="dark"] .link-icon-canva path {
    stroke: var(--bg-color);
}

.link-icon-weixin {
    background: #000;
    border-radius: 4px;
}
.link-icon-weixin rect {
    fill: #000;
}
.link-icon-weixin path {
    fill: #fff;
}
[data-theme="dark"] .link-icon-weixin {
    background: var(--text-color);
}
[data-theme="dark"] .link-icon-weixin rect {
    fill: var(--text-color);
}
[data-theme="dark"] .link-icon-weixin path {
    fill: var(--bg-color);
}

.link-item-text {
    font-size: 16px;
    font-weight: 400;
    letter-spacing: -0.04em;
    color: var(--text-color);
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    margin-bottom: 0;
    line-height: 1.2;
}


/* ========== Responsive: under 768px (tablet) ========== */
@media (max-width: 768px) {
    .container {
        margin: 0 24px;
    }

    .section {
        padding-top: 60px;
    }

    .section-nav {
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .nav-container {
        gap: 24px;
    }

    .nav-button,
    .nav-font {
        font-size: 14px;
    }

    .hero {
        gap: 16px;
    }

    .hero-title-row {
        gap: 12px;
    }

    .hero-title {
        font-size: 28px;
    }

    body.fullpage .hero-title {
        font-size: 34px;
    }

    .hero-caption {
        font-size: 18px;
    }

    .hero-subtitle {
        font-size: 18px;
    }

    .hero-text {
        font-size: 15px;
    }

    /* Featured + secondary: stack vertically on tablet */
    .project-container:has(.project-card-featured) {
        grid-template-columns: 1fr;
    }

    /* Three normal cards: 2 columns on tablet */
    .project-container:has(.project-card-normal):not(:has(.project-card-featured)) {
        grid-template-columns: repeat(2, 1fr);
    }

    .project-card-featured,
    .project-card-featured-secondary,
    .project-card-normal {
        height: 220px;
        padding: 12px;
    }

    .project-title {
        font-size: 18px;
    }

    .card-title {
        font-size: 15px;
    }

    .card-subtitle {
        font-size: 13px;
    }

    .connect-title {
        font-size: 18px;
    }

    .connect-logo {
        width: 28px;
        height: 28px;
    }

    .connnect-text {
        font-size: 15px;
    }

    .footer-text {
        font-size: 13px;
    }
}

/* ========== Responsive: under 520px (mobile) ========== */
@media (max-width: 520px) {
    .container {
        margin: 0 16px;
    }

    .section {
        padding-top: 60px;
    }

    .section-nav {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .nav-container {
        gap: 16px;
    }

    .nav-button,
    .nav-font {
        font-size: 13px;
    }

    .hero {
        gap: 12px;
    }

    .hero-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .hero-title {
        font-size: 24px;
    }

    body.fullpage .hero-title {
        font-size: 30px;
    }

    .hero-caption {
        font-size: 16px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .hero-text {
        font-size: 14px;
    }

    .project-container {
        gap: 12px;
    }

    /* All project grids: single column on mobile */
    .project-container:has(.project-card-featured) {
        grid-template-columns: 1fr;
    }

    .project-container:has(.project-card-normal):not(:has(.project-card-featured)) {
        grid-template-columns: 1fr;
    }

    .project-card-featured,
    .project-card-featured-secondary,
    .project-card-normal {
        height: 200px;
        padding: 12px;
        border-radius: 12px;
    }

    .project-card-featured::before,
    .project-card-featured-secondary::before,
    .project-card-normal::before {
        border-radius: 12px;
    }

    .project-title {
        font-size: 16px;
    }

    .card-title {
        font-size: 14px;
    }

    .card-subtitle {
        font-size: 12px;
    }

    .connect-title {
        font-size: 16px;
    }

    .connect-logo {
        width: 24px;
        height: 24px;
    }

    .connect-button {
        gap: 12px;
    }

    .connect-container {
        gap: 12px;
    }

    .connnect-text {
        font-size: 14px;
    }

    .footer-text {
        font-size: 12px;
    }
}

