/* --- Design System & Variables --- */
:root {
    --bg-color: #050505;
    --card-bg: #111111;
    --text-main: #f0f0f0;
    --text-dim: #888888;
    --accent: #60a5fa; /* Modern Blue */
    --border: #222222;
}

/* --- Base Styles --- */
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 100px 24px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

/* --- Typography & Headers --- */
header {
    margin-bottom: 70px;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin: 0 0 16px 0;
    letter-spacing: -0.05em;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
}

.desc {
    font-size: 1.15rem;
    color: var(--text-dim);
    max-width: 540px;
}

section {
    margin-bottom: 80px; /* Space between sections */
}

h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 60px 0 24px 0;
    display: flex;
    align-items: center;
}

h2::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--border);
    margin-left: 16px;
}

/* --- Now Card (Live Status) --- */
.now-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--accent);
    font-size: 0.95rem;
    color: var(--text-dim);
}

.now-card b { color: var(--text-main); }

/* --- Project Cards (Homepage) --- */
.project-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    display: block;
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    background: #161616;
}

.project-card h3 {
    margin: 0 0 8px 0;
    color: var(--text-main);
    font-size: 1.2rem;
}

.project-card p {
    margin: 0;
    color: var(--text-dim);
    font-size: 1rem;
}

/* --- Book List & Accordion --- */
.list-container {
    border-top: 1px solid var(--border);
}

.book-item {
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
}

.book-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    cursor: pointer;
    position: relative;
}

.book-info {
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.list-item-title {
    font-weight: 500;
    color: var(--text-main);
}

.author {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.hover-quote {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.book-header:hover .hover-quote { opacity: 0.6; }
.book-header:hover .list-item-title { color: var(--accent); }

.arrow {
    color: var(--text-dim);
    transition: transform 0.3s ease;
}

.book-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.book-content p {
    padding: 0 0 24px 0;
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.8;
}

.book-item.active .book-content { max-height: 300px; }
.book-item.active .arrow { transform: rotate(180deg); color: var(--accent); }

/* --- Moments Gallery (Homepage Grid) --- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.photo-item {
    position: relative; 
    aspect-ratio: 1 / 1; /* Square aspect ratio */
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card-bg);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 60%);
    display: flex;
    align-items: flex-end;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.photo-overlay span {
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.photo-item:hover img { transform: scale(1.1); }
.photo-item:hover .photo-overlay {
    opacity: 1;
    transform: translateY(0);
}

/* --- Project Detail Page Specifics --- */
.back-link {
    display: inline-block;
    margin-bottom: 40px;
    color: var(--text-dim);
    font-size: 0.9rem;
    transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

.tag-row { margin-bottom: 40px; }
.tag {
    font-size: 0.8rem;
    background: #1a1a1a;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    margin-right: 8px;
    color: var(--accent);
}

/* --- Project Screenshot Gallery (Side-by-Side) --- */
.project-image {
    width: 100%;
    margin-bottom: 40px;
    display: flex; /* Horizontal layout */
    gap: 12px;
    justify-content: space-between;
}

.project-image img {
    flex: 1; 
    width: 0; /* Essential to prevent overflow */
    height: auto;
    aspect-ratio: 9 / 19; /* Standard mobile screen ratio */
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.project-image img:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.feature-list { padding: 0; list-style: none; }
.feature-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
}
.feature-list li strong { color: var(--text-main); margin-right: 10px; }

/* --- Background Glow & Footer --- */
.glow {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 80% 20%, rgba(96, 165, 250, 0.08) 0%, rgba(0,0,0,0) 50%);
    z-index: -1;
    pointer-events: none;
}

footer {
    margin-top: 100px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

/* --- Responsive Layout --- */
@media (max-width: 600px) {
    .photo-grid { grid-template-columns: 1fr; } /* Stack moments vertically on mobile */
    .photo-overlay { opacity: 1; transform: translateY(0); }
    
    .project-image { flex-direction: column; } /* Stack project screenshots on mobile */
    .project-image img { width: 100%; }
}
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 100px 24px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

/* --- Header --- */
header {
    margin-bottom: 70px;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin: 0 0 16px 0;
    letter-spacing: -0.05em;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
}

.desc {
    font-size: 1.15rem;
    color: var(--text-dim);
    max-width: 540px;
}

/* --- Section Titles --- */
section {
    margin-bottom: 80px;
}

h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 60px 0 24px 0;
    display: flex;
    align-items: center;
}

h2::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--border);
    margin-left: 16px;
}

/* --- Now Card --- */
.now-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--accent);
    font-size: 0.95rem;
    color: var(--text-dim);
}
.now-card b { color: var(--text-main); }

/* --- Project Cards --- */
.project-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    display: block;
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    background: #161616;
}

.project-card h3 {
    margin: 0 0 8px 0;
    color: var(--text-main);
    font-size: 1.2rem;
}

.project-card p {
    margin: 0;
    color: var(--text-dim);
    font-size: 1rem;
}

/* --- Book List & Accordion --- */
.list-container {
    border-top: 1px solid var(--border);
}

.book-item {
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
}

.book-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    cursor: pointer;
    position: relative;
}

.book-info {
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.list-item-title {
    font-weight: 500;
    color: var(--text-main);
}

.author {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.hover-quote {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.book-header:hover .hover-quote {
    opacity: 0.6;
}

.book-header:hover .list-item-title {
    color: var(--accent);
}

.arrow {
    color: var(--text-dim);
    transition: transform 0.3s ease;
}

.book-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.book-content p {
    padding: 0 0 24px 0;
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.8;
}

.book-item.active .book-content {
    max-height: 300px;
}

.book-item.active .arrow {
    transform: rotate(180deg);
    color: var(--accent);
}

/* --- Infinite Scrolling Gallery --- */
.carousel-container::before,
.carousel-container::after {
    content: "";
    position: absolute;
    top: 0;
    width: 100px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}
.carousel-container::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-color), transparent);
}
.carousel-container::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-color), transparent);
}

.carousel-container {
    width: 100%;
    overflow: hidden; /* Hide the photos outside the container */
    padding: 20px 0;
    position: relative;
}

.carousel-track {
    display: flex;
    width: max-content; /* Ensure the track is wide enough for all photos */
    gap: 20px;
    animation: scroll-left 45s linear infinite;

    will-change: transform;
    backface-visibility: hidden; 
}

/* Pause the scrolling when hovering */
.carousel-track:hover {
    animation-play-state: paused;
}

@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }
    100% {
        /* This scrolls exactly half of the track (one full set of images) */
        transform: translateX(-50%);
    }
}

.photo-item {
    flex: 0 0 280px; /* Fixed width for each photo */
    aspect-ratio: 1 / 1;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--card-bg);
    cursor: pointer;
}

/* Keep your existing .photo-item img and .photo-overlay styles */
.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.photo-item:hover img {
    transform: scale(1.1);
}

/* 悬浮遮罩层 */
.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 50%); /* 渐变遮罩，更清晰 */
    display: flex;
    align-items: flex-end; /* 文字放在底部 */
    padding: 20px;
    box-sizing: border-box;
    opacity: 0; /* 默认隐藏 */
    transform: translateY(10px); /* 默认下移一点，增加滑出感 */
    transition: all 0.4s ease;
}

.photo-overlay span {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

/* 悬停时的动作 */
.photo-item:hover img {
    transform: scale(1.1); /* 图片轻微放大 */
}

.photo-item:hover .photo-overlay {
    opacity: 1; /* 遮罩显现 */
    transform: translateY(0); /* 文字滑回正常位置 */
}

/* 手机端适配 */
@media (max-width: 600px) {
    .photo-grid { grid-template-columns: 1fr; }
    .photo-overlay { opacity: 1; transform: translateY(0); } /* 手机端建议直接显示文字 */
}

/* --- Project Detail Specifics --- */
.back-link {
    display: inline-block;
    margin-bottom: 40px;
    color: var(--text-dim);
    font-size: 0.9rem;
    transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

.tag-row { margin-bottom: 40px; }
.tag {
    font-size: 0.8rem;
    background: #1a1a1a;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    margin-right: 8px;
    color: var(--accent);
}

/* --- Project Gallery (Three Images Side-by-Side) --- */
.project-image {
    width: 100%;
    margin-bottom: 40px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.project-image img {
    flex: 1; 
    width: 0;
    height: auto;
    aspect-ratio: 9 / 19;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.project-image img:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

@media (max-width: 600px) {
    .project-image {
        flex-direction: column;
    }
    .project-image img {
        width: 100%;
    }
}

.feature-list { padding: 0; list-style: none; }
.feature-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
}
.feature-list li strong { color: var(--text-main); margin-right: 10px; }

/* --- Footer & Glow --- */
.glow {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 80% 20%, rgba(96, 165, 250, 0.08) 0%, rgba(0,0,0,0) 50%);
    z-index: -1;
    pointer-events: none;
}

footer {
    margin-top: 100px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}


/* --- Added: Hero Buttons --- */
.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.hero-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.hero-button:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.primary-button {
    background: var(--accent);
    border-color: var(--accent);
    color: #07111f;
}

.secondary-button {
    background: var(--card-bg);
    color: var(--text-main);
}

/* --- Added: Project Technology Labels --- */
.project-stack {
    display: block;
    margin-top: 14px;
    color: var(--accent);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

@media (max-width: 600px) {
    .hero-buttons {
        width: 100%;
    }

    .hero-button {
        flex: 1;
    }
}
