/* Import elegant serif font */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&display=swap');

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fdfcfc;
    font-size: 18px;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 500;
    line-height: 1.2;
}

h1 {
    font-size: 1.25rem;
    /* Reduced from 1.5rem */
}

h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #222;
    font-weight: 600;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: #444;
}

p {
    margin-bottom: 1rem;
    color: #555;
}

a {
    color: #333;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header and Navigation */
header {
    background-color: #fdfcfc;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 2rem;
    /* Increased vertical padding from 1.5rem */
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-image {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

nav h1 a {
    color: #333;
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.5rem;
    /* Reduced from 2rem */
    text-decoration: none;
    letter-spacing: 0.5px;
    /* Added letter spacing */
}

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

nav ul li a {
    color: #666;
    font-size: 1rem;
    transition: color 0.2s;
}

nav ul li a:hover {
    color: #222;
    text-decoration: none;
}

nav ul li a.active {
    color: #222;
    font-weight: 500;
}

/* Main sections */
.content-section {
    padding: 3rem 0;
}

.intro {
    padding: 4rem 0;
    background-color: #fdfcfc;
}

.intro-text {
    font-size: 1.5rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    color: #333;
    font-weight: 400;
}

.intro-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 0;
}

/* Work section */
.work-item {
    margin-bottom: 3rem;
}

.work-item:last-child {
    margin-bottom: 0;
}

.work-period {
    font-size: 1rem;
    color: #888;
    margin-bottom: 1rem;
    font-style: italic;
}

/* Thinking section */
.thinking-item {
    margin-bottom: 2.5rem;
}

.thinking-item:last-child {
    margin-bottom: 0;
}

.thinking-item h3 {
    margin-bottom: 1rem;
}

/* Projects section */
.project-item {
    margin-bottom: 2.5rem;
}

.project-item:last-child {
    margin-bottom: 0;
}

/* Portfolio section */
.portfolio-grid {
    display: grid;
    gap: 3rem;
    margin-top: 2rem;
}

.portfolio-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.portfolio-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.portfolio-content h3 {
    margin-bottom: 1rem;
    color: #333;
}

.portfolio-tags {
    font-size: 0.9rem;
    color: #888;
    margin: 1rem 0;
    font-style: italic;
}

.portfolio-link {
    display: inline-block;
    color: #333;
    font-weight: 500;
    margin-top: 0.5rem;
}

.portfolio-link:hover {
    text-decoration: underline;
}

.design-philosophy {
    margin-top: 4rem;
    padding-top: 2rem;
}

.design-philosophy h3 {
    margin-bottom: 1rem;
}

/* Blog section */
.blog-filters {
    margin: 2rem 0;
}

.filter-section label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #333;
    color: #333;
}

.filter-btn.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

.blog-posts {
    margin-top: 2rem;
}

.blog-post {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
}

.blog-post:last-child {
    margin-bottom: 0;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.post-meta time {
    color: #888;
}

.post-tags {
    display: flex;
    gap: 0.5rem;
}

.tag {
    background: #f5f5f5;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    color: #666;
}

.blog-post h3 {
    margin-bottom: 1rem;
    color: #333;
}

.read-more {
    color: #333;
    font-weight: 500;
    display: inline-block;
    margin-top: 1rem;
}

.read-more:hover {
    text-decoration: underline;
}

.project-item h3 {
    margin-bottom: 1rem;
}

/* Footer */
footer {
    padding: 2rem 0;
    margin-top: 3rem;
    background-color: #fdfcfc;
}

footer p {
    text-align: center;
    color: #666;
    font-size: 1rem;
    margin: 0;
}

footer a {
    color: #666;
}

footer a:hover {
    color: #333;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .container {
        padding: 0 1.5rem;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 1.5rem;
    }

    .nav-left {
        flex-direction: column;
        gap: 0.5rem;
    }

    nav ul {
        gap: 1.5rem;
    }

    .intro {
        padding: 2.5rem 0;
    }

    .intro-text {
        font-size: 1.25rem;
    }

    .content-section {
        padding: 2rem 0;
    }

    h2 {
        font-size: 1.5rem;
    }

    .portfolio-item {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .filter-buttons {
        justify-content: center;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}


/* Typewriter Effect */
.typewriter-container {
    padding: 6rem 0 4rem;
    /* More top padding */
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.typewriter h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: #222;
    overflow: hidden;
    /* Ensures the content is not revealed until the animation */
    border-right: .15em solid #333;
    /* The typwriter cursor */
    white-space: nowrap;
    /* Keeps the content on a single line */
    margin: 0 auto;
    /* Gives that scrolling effect as the typing happens */
    animation:
        typing 3.5s steps(40, end),
        blink-caret .75s step-end infinite;
    max-width: fit-content;
}

/* The typing effect */
@keyframes typing {
    from {
        width: 0
    }

    to {
        width: 100%
    }
}

/* The typewriter cursor effect */
@keyframes blink-caret {

    from,
    to {
        border-color: transparent
    }

    50% {
        border-color: #333
    }
}

/* Feature Sections (Kilimanjaro & Chess) */
.feature-section {
    padding: 4rem 0;
    border-top: 1px solid #eee;
}

.feature-content {
    display: flex;
    gap: 3rem;
    align-items: center;
}

.feature-content.reverse {
    flex-direction: row-reverse;
}

.feature-text {
    flex: 1;
}

.feature-image {
    flex: 1;
}

.feature-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .typewriter h1 {
        font-size: 2rem;
        white-space: normal;
        /* Allow wrap on mobile if needed, though typewriter usually needs nowrap */
        animation: none;
        /* Disable animation on small screens if it breaks layout */
        border: none;
    }

    .feature-content,
    .feature-content.reverse {
        flex-direction: column;
        gap: 2rem;
    }
}

/* Chess Page Specifics */
.chess-intro {
    max-width: 700px;
    margin-bottom: 3rem;
}

.chess-image-container {
    display: grid;
    grid-template-rows: auto 1fr;
    position: relative;
    align-content: stretch;
}

.chess-top-image {
    grid-row: 1;
    align-self: start;
}

.chess-bottom-section {
    grid-row: 2;
    align-self: end;
    margin-top: auto;
}

/* Ensure stable positioning regardless of when board loads */
.chess-image-container {
    height: calc(100vh - 300px); /* Fixed height independent of left column */
    max-height: 800px;
    min-height: 500px;
}

.full-width-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Integrated Spotlight Section (Kilimanjaro) */
.spotlight-section {
    background-color: #fafafa;
    /* Subtle grey background */
    padding: 5rem 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.spotlight-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.spotlight-quote {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    line-height: 1.4;
    color: #222;
    font-style: italic;
    margin-bottom: 1rem;
}

.spotlight-text {
    font-size: 1.1rem;
    color: #555;
    line-height: 1.6;
}

.spotlight-image-wrapper {
    margin-top: 2rem;
    position: relative;
    display: inline-block;
}

.spotlight-image-wrapper img {
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.bw-filter {
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.bw-filter:hover {
    filter: grayscale(0%);
}