:root {
    /* Color Palette - Light Mode (Ivory White & Forest Green Highlights) */
    --bg-primary: #faf8f5;     /* Clean, premium ivory-white background */
    --bg-secondary: #ffffff;   /* Pure white panels */
    --text-primary: #111111;   /* Off-black for primary typography and titles */
    --text-secondary: #2d3532; /* Charcoal forest-grey for body text */
    --text-muted: #7d8b85;     /* Muted sage-grey for dates and metadata */
    --accent: #0b5e43;         /* Rich pine forest green for active accents and highlights */
    --accent-hover: #073c2a;
    --accent-light: #f0f6f3;   /* Soft, pastel green-tinted ivory highlight background */
    --accent-border: #cfe0d8;  /* Soft green-tinted borders */
    --border-color: #e5e2d9;   /* Neutral light warm grey borders */
    --border-hover: #0b5e43;   /* Green border highlight on hover */
    --card-shadow: none;       /* Flat grid, no shadows! */
    --card-shadow-hover: none; /* Flat grid, no shadows! */
    
    --font-heading: 'Lora', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}


html[data-theme="light"] {
    --bg-primary: #faf8f5;     /* Clean, premium ivory-white background */
    --bg-secondary: #ffffff;   /* Pure white panels */
    --text-primary: #111111;   /* Off-black for primary typography and titles */
    --text-secondary: #2d3532; /* Charcoal forest-grey for body text */
    --text-muted: #7d8b85;     /* Muted sage-grey for dates and metadata */
    --accent: #0b5e43;         /* Rich pine forest green for active accents and highlights */
    --accent-hover: #073c2a;
    --accent-light: #f0f6f3;   /* Soft, pastel green-tinted ivory highlight background */
    --accent-border: #cfe0d8;  /* Soft green-tinted borders */
    --border-color: #e5e2d9;   /* Neutral light warm grey borders */
    --border-hover: #0b5e43;   /* Green border highlight on hover */
}

html[data-theme="dark"] {
    --bg-primary: #060b09;      /* Deepest dark-pine background */
    --bg-secondary: #0d1411;    /* Dark pine-slate panels */
    --text-primary: #faf8f5;    /* Warm ivory text */
    --text-secondary: #a6b4b0;  /* Muted sage body text */
    --text-muted: #5e6f6a;      /* Dark sage timestamps */
    --accent: #34d399;          /* Mint green for active accents and highlights */
    --accent-hover: #6ee7b7;
    --accent-light: rgba(52, 211, 153, 0.08); /* Translucent mint green highlight */
    --accent-border: rgba(52, 211, 153, 0.2);  /* Mint green borders */
    --border-color: #14221d;
    --border-hover: #34d399;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    line-height: 1.75;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: var(--transition);
}

/* Page wrapper */
.page {
    display: flex;
    gap: 4rem;
    max-width: 1000px;
    margin: 0 auto;
    padding: 6rem 2rem 6rem;
}

/* Navigation — left sidebar */
nav {
    position: sticky;
    top: 6rem;
    flex-shrink: 0;
    width: 160px;
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 500;
    font-style: italic; /* Classic editorial italic serif links */
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 0;
    border-radius: 0;
    border: none;
    background: none !important;
    transition: var(--transition);
    position: relative;
    display: inline-flex;
    width: fit-content;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--border-hover);
    transition: var(--transition);
}

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

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link.active {
    color: var(--border-hover);
    font-weight: 600;
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 500;
    font-style: italic;
    color: var(--text-secondary);
    padding: 0.5rem 0;
    margin-top: 1rem;
    transition: var(--transition);
    width: fit-content;
    text-align: left;
}

.theme-toggle-btn:hover {
    color: var(--border-hover);
}

.theme-toggle-btn svg {
    width: 16px;
    height: 16px;
    margin-right: 0.5rem;
    flex-shrink: 0;
    transition: var(--transition);
}

.container {
    flex: 1;
    min-width: 0;
}

/* Header */
header {
    margin-bottom: 4rem;
}

.header-row {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

/* Sequoia Style Portrait Profile Container */
.profile-pic-container {
    position: relative;
    width: 130px;
    height: 160px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    transition: var(--transition);
    flex-shrink: 0;
}

.profile-pic-container:hover {
    transform: scale(1.02);
    border-color: var(--border-hover);
}

.profile-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 42% 10%;
    position: relative;
    z-index: 2;
}

.profile-avatar-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--bg-primary) 100%);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    z-index: 1;
    user-select: none;
}

.header-text {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

h1 {
    font-family: var(--font-heading);
    font-size: 2.75rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.1;
}

.tagline {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background-color: transparent;
    color: var(--text-secondary);
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    width: fit-content;
    margin-top: 0.25rem;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    position: relative;
}

.status-dot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #10b981;
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(3.5);
        opacity: 0;
    }
}

/* Sections */
.section {
    margin-bottom: 5rem;
}

h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-transform: capitalize;
}

h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

/* About Section */
.bio {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.75;
}

/* Social links badges */
.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.social-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    transition: var(--transition);
}

.social-badge:hover {
    color: var(--bg-primary);
    background-color: var(--border-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.social-icon {
    width: 14px;
    height: 14px;
}

.resume-badge {
    color: var(--text-primary);
    border-color: var(--text-primary);
    font-weight: 600;
}

.resume-badge:hover {
    background-color: var(--border-hover);
    color: var(--bg-primary);
    border-color: var(--border-hover);
}

/* Experience Table Grid */
.experience-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.experience-list::before {
    display: none;
}

.experience-item {
    position: relative;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.experience-item:first-child {
    padding-top: 0;
}

.experience-item::before,
.experience-item:hover::before {
    display: none;
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 1.5rem;
}

.experience-item h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
}

.company {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.date {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.description {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Projects Card Grid (Flat Table structure) */
.project-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
}

.project-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    background-color: transparent;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: none;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.project-item:hover {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    transform: none;
    box-shadow: none;
}

.project-item:hover h3 {
    color: var(--border-hover);
    text-decoration: underline;
}

.project-info {
    margin-bottom: 1.5rem;
}

.project-info h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.project-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.arrow {
    font-size: 1rem;
    opacity: 0.4;
    transition: var(--transition);
}

.project-item:hover .arrow {
    opacity: 1;
    color: var(--accent);
    transform: translate(2px, -2px);
}

.project-tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-tech {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background-color: transparent;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Writing Section (Flat list stack) */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.article-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 2rem 0;
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: none;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.article-item:first-child {
    padding-top: 0;
}

.article-item:hover {
    border-color: var(--border-color);
    background-color: transparent;
    transform: none;
    box-shadow: none;
}

.article-item:hover h3 {
    color: var(--border-hover);
    text-decoration: underline;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.article-read-time {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.article-content h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.article-excerpt {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.article-item:hover .arrow {
    opacity: 1;
    color: var(--accent);
    transform: translate(2px, -2px);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.article-tag {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

/* Writing Footer and View All Button */
.writing-footer {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

.btn-all-posts {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
}

.btn-all-posts:hover {
    background-color: var(--border-hover);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

.btn-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.btn-all-posts:hover .btn-icon {
    transform: translateX(3px);
}

/* Reader Page Layout (Standalone Essays) */
.reader-page {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-family: var(--font-body);
    line-height: 1.8;
}

.reader-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 6rem 1.5rem;
}

.reader-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.reader-theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.reader-theme-btn:hover {
    color: var(--border-hover);
    border-color: var(--border-hover);
    background-color: var(--accent-light);
}

.reader-theme-btn svg {
    width: 16px;
    height: 16px;
}

.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

html[data-theme="dark"] .sun-icon {
    display: block;
}

html[data-theme="dark"] .moon-icon {
    display: none;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--text-primary);
    transform: translateX(-4px);
}

.reader-header h1 {
    font-family: var(--font-heading);
    font-size: 2.75rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.15;
}

.reader-content {
    margin-top: 3rem;
}

.reader-content p {
    font-size: 1.05rem;
    margin-bottom: 1.75rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.reader-content h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-top: 3rem;
    margin-bottom: 1.25rem;
}

.reader-content h2::after {
    display: none;
}

.reader-content ul {
    margin-bottom: 1.75rem;
    padding-left: 1.5rem;
}

.reader-content li {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.reader-content blockquote {
    border-left: 3px solid var(--text-primary);
    padding-left: 1.75rem;
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 2.5rem 0;
}

.reader-footer {
    margin-top: 6rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Footer */
footer {
    margin-top: 6rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

footer p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

/* Custom override for theme toggle in footer */
footer .theme-toggle-btn {
    margin-top: 0;
    padding: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

footer .theme-toggle-btn:hover {
    color: var(--border-hover);
}

footer .theme-toggle-btn svg {
    width: 14px;
    height: 14px;
    margin-right: 0.4rem;
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header,
.section,
nav {
    animation: fadeUp 0.5s ease-out both;
}

nav { animation-delay: 0s; }
header { animation-delay: 0.05s; }
#about { animation-delay: 0.1s; }
#experience { animation-delay: 0.15s; }
#projects { animation-delay: 0.2s; }
#writing { animation-delay: 0.25s; }
footer { animation: fadeUp 0.5s ease-out both; animation-delay: 0.3s; }

/* Responsive Styles */
@media (max-width: 768px) {
    .page {
        flex-direction: column;
        gap: 2rem;
        padding: 1.5rem 1.5rem 3rem;
    }

    nav {
        position: static;
        width: 100%;
        flex-direction: row;
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border-color);
        scrollbar-width: none;
    }

    nav::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        white-space: nowrap;
    }

    .theme-toggle-btn {
        margin-top: 0;
        white-space: nowrap;
    }

    .container {
        padding: 0;
    }

    .header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .project-list {
        grid-template-columns: 1fr;
        border-left: none;
    }

    .project-item {
        border-right: none;
    }

    .experience-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
