/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Present of Coding Brand */
    --forest-green: #2D6A4F;
    --forest-green-dark: #245A42;
    --forest-green-light: #40916C;
    --amber: #D4A03C;
    --text-primary: #3D2B1F;
    --text-secondary: #7A6E62;
    --text-muted: #7A6E62;
    --bg-primary: #FFF8F0;
    --bg-secondary: #F5EDE0;
    --bg-card: #FFF8F0;
    --border-color: #E8DDD0;
    --border-light: #F5EDE0;
    --shadow-sm: 0 1px 3px rgba(61, 43, 31, 0.08);
    --shadow-md: 0 4px 8px rgba(61, 43, 31, 0.1);
    --shadow-lg: 0 4px 16px rgba(61, 43, 31, 0.1);
    --code-bg: #2A211A;
    --code-text: #F5EDE0;
    --radius: 0.5rem;
}

[data-theme="dark"] {
    --forest-green: #52B788;
    --forest-green-dark: #74C69D;
    --forest-green-light: #95D5B2;
    --amber: #E8B84A;
    --text-primary: #F5EDE0;
    --text-secondary: #A89888;
    --text-muted: #A89888;
    --bg-primary: #1C1612;
    --bg-secondary: #2A211A;
    --bg-card: #2A211A;
    --border-color: #3D2B1F;
    --border-light: #2A211A;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
    --code-bg: #1C1612;
    --code-text: #F5EDE0;
}

body {
    font-family: 'Source Sans 3', -apple-system, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-weight: 600;
    line-height: 1.2;
}

a {
    color: var(--forest-green);
    text-decoration: underline;
    text-decoration-color: rgba(45, 106, 79, 0.25);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

a:hover {
    color: var(--forest-green-dark);
    text-decoration-color: var(--forest-green);
}

/* Remove underlines from nav, buttons, project links, social links */
.nav-link,
.btn,
.project-link,
.social-links a,
.footer-links a,
.article-link {
    text-decoration: none;
}

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

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.nav-brand {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color 0.2s ease;
    position: relative;
    padding: 0.5rem 0;
}

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--forest-green);
    transition: width 0.3s ease;
}

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

.nav-link.active {
    color: var(--forest-green);
}

/* Dark mode toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.375rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.2s ease;
}

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

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    width: 18px;
    height: 18px;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

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

/* Hero Section */
.hero {
    padding-top: calc(64px + 4rem);
    padding-bottom: 4rem;
    background: var(--bg-primary);
}

.hero-content {
    text-align: left;
    max-width: 720px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.hero-description {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 2rem;
}

.hero-highlight {
    color: var(--forest-green);
    font-weight: 600;
}

.hero-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.5rem 1.125rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-primary {
    background: var(--forest-green);
    color: #FFF8F0;
}

.btn-primary:hover {
    background: var(--forest-green-dark);
    color: #FFF8F0;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--forest-green);
    color: var(--forest-green);
}

.btn-outline {
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: transparent;
}

.btn-outline:hover {
    border-color: var(--forest-green);
    color: var(--forest-green);
}

/* Sections */
section {
    padding: 4rem 0;
}

.section-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.75rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.0625rem;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Projects Section */
.projects {
    background: var(--bg-secondary);
}

.project-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 2.5rem;
}

@media (min-width: 768px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.project-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
    border-color: var(--amber);
    box-shadow: var(--shadow-md);
}

.project-card.featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    grid-column: span 2;
}

@media (max-width: 1024px) {
    .project-card.featured {
        grid-template-columns: 1fr;
        grid-column: span 1;
    }
}

/* Project Visuals */
.project-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-screenshot {
    width: 100%;
}

.project-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

/* Project Info */
.project-info {
    display: flex;
    flex-direction: column;
}

.project-header h3 {
    margin-bottom: 0.75rem;
    font-size: 1.375rem;
}

.project-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-block;
    padding: 0.1875rem 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.badge:hover {
    border-color: var(--forest-green);
    color: var(--forest-green);
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

.project-links {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--forest-green);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.project-link:hover {
    color: var(--forest-green-dark);
}

/* Gallery Section */
.gallery-section {
    padding: 5rem 0;
    background: var(--bg-secondary);
}

.gallery-category-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--forest-green);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 2.5rem 0 1rem;
    padding-left: 0.75rem;
    border-left: 3px solid var(--forest-green);
    font-family: 'JetBrains Mono', monospace;
}

.gallery-category-label:first-of-type {
    margin-top: 1rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 0.5rem;
}

.gallery-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    display: block;
    text-decoration: none;
    color: inherit;
}

.gallery-card:hover {
    border-color: var(--amber);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    text-decoration: none;
    color: inherit;
}

.gallery-thumb {
    width: 100%;
    height: 175px;
    object-fit: cover;
    object-position: top;
    display: block;
    border-bottom: 1px solid var(--border-color);
}

.gallery-card-body {
    padding: 0.875rem 1rem 1rem;
}

.gallery-card-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.gallery-card-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Writing Section */
.writing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

@media (max-width: 1024px) {
    .writing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .writing-grid {
        grid-template-columns: 1fr;
    }
}

.article-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card:hover {
    border-color: var(--amber);
    box-shadow: var(--shadow-md);
}

.article-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover .article-image img {
    transform: scale(1.03);
}

.article-content {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
}

.article-date {
    color: var(--text-muted);
}

.article-category {
    color: var(--forest-green);
    font-weight: 500;
}

.article-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.0625rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.article-link:hover {
    color: var(--forest-green);
}

.article-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.writing-cta {
    text-align: center;
}

/* Talks Section */
.talks {
    background: var(--bg-secondary);
}

.talks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.talk-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.talk-card:hover {
    border-color: var(--amber);
    box-shadow: var(--shadow-md);
}

.talk-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.talk-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.talk-content {
    padding: 1.25rem;
}

.talk-content h3 {
    margin-bottom: 0.375rem;
    font-size: 1.125rem;
}

.talk-venue {
    color: var(--forest-green);
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

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

/* Contact Section */
.contact {
    background: var(--bg-secondary);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 900px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .contact-content {
        grid-template-columns: 1fr;
    }
}

.contact-form {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--forest-green);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contact-item h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.contact-item a {
    color: var(--forest-green);
    text-decoration: none;
    font-size: 1rem;
}

.contact-item a:hover {
    color: var(--forest-green-dark);
}

.social-links {
    display: flex;
    gap: 0.75rem;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.social-links a:hover {
    background: var(--forest-green);
    color: #FFF8F0;
    border-color: var(--forest-green);
}

/* Footer */
.footer {
    background: #3D2B1F;
    color: #FFF8F0;
    padding: 3rem 0 1.5rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.footer-section h3 {
    color: #FFF8F0;
    margin-bottom: 1rem;
    font-size: 1.0625rem;
}

.footer-section p {
    color: #A89888;
    line-height: 1.6;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #A89888;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #FFF8F0;
}

.footer .social-links a {
    background: rgba(255, 248, 240, 0.1);
    color: #FFF8F0;
    border-color: rgba(255, 248, 240, 0.15);
}

.footer .social-links a:hover {
    background: var(--forest-green);
    border-color: var(--forest-green);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 248, 240, 0.1);
    padding-top: 1.5rem;
    text-align: center;
    color: #7A6E62;
    font-size: 0.875rem;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: var(--forest-green);
    color: #FFF8F0;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    border: none;
}

.back-to-top:hover {
    background: var(--forest-green-dark);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

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

.animate-in {
    animation: fadeInUp 0.5s ease forwards;
}

.project-card,
.article-card,
.talk-card {
    opacity: 0;
    transform: translateY(20px);
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--forest-green);
    color: #FFF8F0;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 var(--radius) 0;
    z-index: 1100;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.25rem;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 1rem 24px;
        gap: 0;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        padding: 0.5rem 0;
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    section {
        padding: 3rem 0;
    }

    .hero {
        padding-top: calc(64px + 2.5rem);
    }
}
