/* ===== CSS Variables ===== */
:root {
    --color-bg: #faf9f7;
    --color-text: #2c2c2c;
    --color-text-muted: #6b6b6b;
    --color-accent: #8b7355;
    --color-accent-light: #c4b5a0;
    --color-border: #e8e4df;
    --color-nav-bg: rgba(250, 249, 247, 0.9);
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans: 'Karla', -apple-system, sans-serif;
}

/* Dark mode */
[data-theme="dark"] {
    --color-bg: #1a1a1a;
    --color-text: #e8e4df;
    --color-text-muted: #a0a0a0;
    --color-accent: #c4a77d;
    --color-accent-light: #8b7355;
    --color-border: #333;
    --color-nav-bg: rgba(26, 26, 26, 0.9);
}

/* Black & White mode */
[data-theme="bw"] {
    --color-bg: #ffffff;
    --color-text: #000000;
    --color-text-muted: #555555;
    --color-accent: #000000;
    --color-accent-light: #888888;
    --color-border: #cccccc;
    --color-nav-bg: rgba(255, 255, 255, 0.9);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Navigation ===== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px 40px;
    background: var(--color-nav-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
}

.nav-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-logo:hover {
    color: var(--color-accent);
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text-muted);
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--color-accent);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    color: var(--color-text-muted);
    transition: color 0.2s ease, transform 0.2s ease;
    line-height: 1;
}

.theme-toggle:hover {
    color: var(--color-accent);
    transform: scale(1.1);
}

/* Light mode: show moon (next: dark) */
.theme-toggle .icon-moon {
    display: inline;
}
.theme-toggle .icon-bw,
.theme-toggle .icon-sun {
    display: none;
}

/* Dark mode: show B&W icon (next: bw) */
[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}
[data-theme="dark"] .theme-toggle .icon-bw {
    display: inline;
}
[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

/* B&W mode: show sun (next: light) */
[data-theme="bw"] .theme-toggle .icon-moon {
    display: none;
}
[data-theme="bw"] .theme-toggle .icon-bw {
    display: none;
}
[data-theme="bw"] .theme-toggle .icon-sun {
    display: inline;
}

/* ===== Layout ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 120px 40px 80px;
}

/* ===== Hero Section ===== */
.hero {
    display: flex;
    gap: 60px;
    align-items: center;
    margin-bottom: 100px;
    animation: fadeIn 0.8s ease-out;
}

.hero-image {
    flex-shrink: 0;
}

.image-placeholder {
    width: 220px;
    height: 280px;
    background: linear-gradient(145deg, var(--color-border), var(--color-bg));
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .image-placeholder {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease-in-out, filter 0.3s ease;
}

.image-placeholder .img-hover {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.image-placeholder:hover .img-default {
    opacity: 0;
}

.image-placeholder:hover .img-hover {
    opacity: 1;
}

[data-theme="bw"] .image-placeholder img {
    filter: grayscale(100%);
}

.image-placeholder .placeholder-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-text-muted);
    font-size: 14px;
    letter-spacing: 0.5px;
}

.image-placeholder:not(.no-image) .placeholder-text {
    display: none;
}

.hero-content {
    padding-top: 0;
}

.hero-content h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 24px;
    color: var(--color-text);
}

.hero-content .name {
    color: var(--color-accent);
}

.hero-content .intro {
    font-size: 1.05rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
    max-width: 480px;
}

.hero-content .subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--color-accent);
}

.text-link {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.text-link:hover {
    color: var(--color-text);
}

/* ===== Timeline Section ===== */
.timeline-section {
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.timeline-section h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 50px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 50px;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.5s ease-out forwards;
}

.timeline-item:nth-child(1) { animation-delay: 0.3s; }
.timeline-item:nth-child(2) { animation-delay: 0.45s; }
.timeline-item:nth-child(3) { animation-delay: 0.6s; }
.timeline-item:nth-child(4) { animation-delay: 0.75s; }

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -40px;
    top: 8px;
    width: 15px;
    height: 15px;
    background: var(--color-bg);
    border: 2px solid var(--color-accent-light);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.timeline-item:hover .timeline-marker {
    background: var(--color-accent);
    border-color: var(--color-accent);
    transform: scale(1.2);
}

.timeline-content {
    padding-left: 10px;
}

.timeline-date {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-accent);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.timeline-content h3 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--color-text);
}

.timeline-content p {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    max-width: 560px;
    line-height: 1.75;
}

/* ===== Page Header (for sub-pages) ===== */
.page-header {
    margin-bottom: 60px;
    animation: fadeIn 0.8s ease-out;
}

.page-header h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--color-text);
}

.page-subtitle {
    font-size: 1.05rem;
    color: var(--color-text-muted);
}

/* ===== Writings List ===== */
.writings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.writing-item {
    animation: fadeIn 0.5s ease-out both;
}

.writing-item:nth-child(1) { animation-delay: 0.1s; }
.writing-item:nth-child(2) { animation-delay: 0.2s; }
.writing-item:nth-child(3) { animation-delay: 0.3s; }
.writing-item:nth-child(4) { animation-delay: 0.4s; }
.writing-item:nth-child(5) { animation-delay: 0.5s; }

.writing-link {
    display: block;
    padding: 24px;
    margin: 0 -24px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.writing-link:hover {
    background-color: var(--color-border);
}

.writing-date {
    display: block;
    font-size: 0.85rem;
    color: var(--color-accent);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.writing-link h2 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 8px;
    transition: color 0.2s ease;
}

.writing-link:hover h2 {
    color: var(--color-accent);
}

.writing-link p {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* ===== Projects List ===== */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.project-item {
    animation: fadeIn 0.5s ease-out both;
}

.project-item:nth-child(1) { animation-delay: 0.1s; }
.project-item:nth-child(2) { animation-delay: 0.2s; }
.project-item:nth-child(3) { animation-delay: 0.3s; }
.project-item:nth-child(4) { animation-delay: 0.4s; }
.project-item:nth-child(5) { animation-delay: 0.5s; }

.project-link {
    display: block;
    padding: 24px;
    margin: 0 -24px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.project-link:hover {
    background-color: var(--color-border);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.project-link h2 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--color-text);
    transition: color 0.2s ease;
}

.project-arrow {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

.project-link:hover h2 {
    color: var(--color-accent);
}

.project-link:hover .project-arrow {
    color: var(--color-accent);
    transform: translate(3px, -3px);
}

.project-link p {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 14px;
}

.project-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.75rem;
    color: var(--color-accent);
    background: transparent;
    border: 1px solid var(--color-border);
    padding: 4px 10px;
    border-radius: 3px;
    letter-spacing: 0.3px;
}

/* ===== Footer ===== */
footer {
    margin-top: 100px;
    padding-top: 30px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

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

.social-links a:hover {
    color: var(--color-accent);
}

footer p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav {
        padding: 16px 24px;
    }

    .nav-links {
        gap: 20px;
    }

    .container {
        padding: 100px 24px 60px;
    }

    .hero {
        flex-direction: column;
        gap: 40px;
        margin-bottom: 70px;
    }

    .image-placeholder {
        width: 180px;
        height: 230px;
    }

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

    .timeline {
        padding-left: 30px;
    }

    .timeline-marker {
        left: -30px;
        width: 12px;
        height: 12px;
    }

    .timeline::before {
        left: 5px;
    }

    .timeline-item {
        padding-bottom: 40px;
    }

    .timeline-content h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 40px 20px;
    }

    .hero-content h1 {
        font-size: 1.75rem;
    }

    .timeline-section h2 {
        font-size: 1.6rem;
    }
}

