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

:root {
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-link: #0066cc;
    --text-link-hover: #004499;
    --bg-white: #ffffff;
    --border-light: #e0e0e0;
    --photo-size: 120px;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    font-size: 18px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-white);
    padding: 40px 20px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Sidebar with photo and navigation */
.sidebar {
    position: fixed;
    top: 40px;
    left: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Photo container */
.photo-container {
    position: relative;
}

.photo {
    width: var(--photo-size);
    height: var(--photo-size);
    border-radius: 50%;
    overflow: hidden;
    background: #f5f5f5;
    transition: transform 0.6s ease, opacity 0.6s ease;
    cursor: pointer;
    transform-style: preserve-3d;
}

.photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 600;
    color: var(--text-secondary);
    background: #e8e8e8;
}

/* Contact icons - hidden by default, positioned in same space as photo */
.contact-icons {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--photo-size);
    height: var(--photo-size);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transform: rotateY(180deg);
    transition: transform 0.6s ease, opacity 0.6s ease;
    pointer-events: none;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.photo-container:hover .photo {
    transform: rotateY(180deg);
    opacity: 0;
}

.photo-container:hover .contact-icons {
    transform: rotateY(0deg);
    opacity: 1;
    pointer-events: auto;
}

.contact-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--text-primary);
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    transition: all 0.2s ease;
    text-decoration: none;
}

.contact-icons a:hover {
    color: var(--text-link);
    border-color: var(--text-link);
    transform: scale(1.1);
}

.contact-icons svg {
    width: 20px;
    height: 20px;
}

/* Section navigation */
.section-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 16px;
    padding: 8px 0;
    transition: color 0.2s ease;
    position: relative;
}

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

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

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--text-primary);
    border-radius: 2px;
}

/* Main content */
main {
    max-width: 700px;
    margin-left: 220px; /* Space for sidebar */
    flex: 1; /* Grow to push footer down */
}

section {
    margin-bottom: 80px;
}

/* Typography */
h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

h2 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}

h3 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.section-intro {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 18px;
}

/* Bio section */
.bio p {
    margin-bottom: 20px;
}

.bio p:last-child {
    margin-bottom: 0;
}

/* Article/Talk/Project/Thought previews */
.article-preview,
.talk-preview,
.project-preview,
.thought-preview {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-light);
}

.article-preview:last-child,
.talk-preview:last-child,
.project-preview:last-child,
.thought-preview:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.thought-content {
    margin-top: 16px;
    line-height: 1.8;
}

.thought-content p {
    margin-bottom: 16px;
}

.thought-content p:last-child {
    margin-bottom: 0;
}

.article-preview h3 a,
.project-preview h3 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.article-preview h3 a:hover,
.project-preview h3 a:hover {
    color: var(--text-link);
}

.date {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tech {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 12px;
}

.links {
    margin-top: 12px;
}

.links a {
    color: var(--text-link);
    text-decoration: none;
    margin-right: 20px;
    font-size: 16px;
    transition: color 0.2s ease;
}

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

/* General links */
a {
    color: var(--text-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Contact section */
#contact p {
    margin-bottom: 16px;
}

/* Footer */
footer {
    margin-top: 80px;
    margin-left: 220px; /* Align with main content */
    padding-top: 32px;
    border-top: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 14px;
    max-width: 700px;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 20px;
    }

    .sidebar {
        position: relative;
        top: auto;
        left: auto;
        align-items: center;
        margin-bottom: 40px;
    }

    .section-nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }

    .nav-link.active::before {
        display: none;
    }

    .contact-icons {
        flex-direction: row;
    }

    .photo-container:hover .contact-icons {
        transform: rotateY(0deg);
    }

    main {
        margin-left: 0;
    }

    footer {
        margin-left: 0;
    }

    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 26px;
    }

    h3 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    :root {
        --photo-size: 100px;
    }

    body {
        font-size: 16px;
        padding-top: 140px;
    }

    h1 {
        font-size: 28px;
    }

    h2 {
        font-size: 24px;
    }
}
