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

:root {
    --font-mono: 'Space Mono', monospace;
    --font-sans: 'Inter', sans-serif;
    --color-text: #ffffff;
    --color-bg: #000000;
}


html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.4;
    color: var(--color-text);
    font-feature-settings: "liga" 1, "kern" 1;
    transition: background-color 0.3s ease, color 0.3s ease, background-image 0.3s ease;
    /* Pale Blue Dot background on all pages */
    background: 
        linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
        url('/pale-blue-dot.jpg') center/cover no-repeat fixed;
    background-color: transparent !important;
}


/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    z-index: 1000;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: flex-start;
}

.nav-links .nav-link:first-child {
    margin-bottom: 1.4em;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: opacity 0.2s ease;
    cursor: pointer;
    display: inline-block;
    position: relative;
}

.nav-link:hover {
    opacity: 0.5;
}

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

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

/* Back Link (shown on sub-pages) - matches nav styling exactly */
.back-link-container {
    position: relative;
    padding: 0;
    margin-bottom: 1.5rem;
    pointer-events: none;
}

.back-link-container .back-link {
    pointer-events: auto;
}

.back-link {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: opacity 0.2s ease;
    cursor: pointer;
    display: inline-block;
    position: relative;
}

.back-link:hover {
    opacity: 0.5;
}

.back-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--color-text);
    transition: width 0.2s ease;
}

.back-link:hover::after {
    width: 100%;
}

/* Main Content */
main {
    min-height: 100vh;
    padding: 2rem;
}

/* When navigation is visible, add top padding */
body.has-nav main {
    padding-top: 8rem;
}

/* When back link is present, no extra padding needed since it's in document flow */
body.has-back-link main {
    padding-top: 2rem;
}

/* Home Page */
.home {
    max-width: 800px;
}

/* About Page */
.about {
    max-width: 700px;
}

.about p {
    font-size: 14px;
    line-height: 1.625;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.about a {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: opacity 0.2s ease;
}

.about a:hover {
    opacity: 0.6;
}

/* Writing Page */
.writing {
    max-width: 800px;
}

.writing-list {
    list-style: none;
    margin-top: 2rem;
}

.writing-item {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.writing-item:last-child {
    border-bottom: none;
}

.writing-item h2 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.writing-item p {
    font-size: 14px;
    line-height: 1.625;
    color: var(--color-text);
}

.writing-item a {
    color: var(--color-text);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.writing-item a {
    color: var(--color-text);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.writing-item a:hover {
    opacity: 0.6;
}

/* Writing Post Page */
.writing-post {
    max-width: 800px;
}

.post-introduction {
    font-size: 14px;
    line-height: 1.625;
    color: var(--color-text);
    margin-bottom: 2rem;
}

.post-introduction h2 {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
    margin-top: 0;
}

.post-introduction p {
    margin-bottom: 1.5rem;
    line-height: 1.625;
}

.post-content {
    font-size: 14px;
    line-height: 1.625;
    color: var(--color-text);
}

.post-content h1 {
    display: none;
}

.post-content h2 {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.post-content h3 {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.post-content p {
    margin-bottom: 1.5rem;
    line-height: 1.625;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.post-content li {
    margin-bottom: 0.5rem;
    line-height: 1.625;
}

.post-content strong {
    font-weight: 500;
}

.post-content a {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: opacity 0.2s ease;
}

.post-content a:hover {
    opacity: 0.6;
}

/* Code blocks */
.post-content pre {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 13px;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    display: block;
}

/* Mermaid diagrams */
.post-content .mermaid {
    margin: 2rem 0;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 4px;
    text-align: center;
}

.post-content .mermaid svg {
    max-width: 100%;
    height: auto;
}

/* YouTube embeds */
.post-content .youtube-embed-wrapper,
.post-introduction .youtube-embed-wrapper {
    margin: 2rem 0;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
}

.post-content .youtube-embed,
.post-introduction .youtube-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* LaTeX/KaTeX math styling */
.post-content .katex,
.post-introduction .katex,
.about .katex {
    font-size: 1.71875em;
    color: var(--color-text);
}

.post-content .katex-display,
.post-introduction .katex-display,
.about .katex-display {
    margin: 2rem 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.post-content .katex-display > .katex,
.post-introduction .katex-display > .katex,
.about .katex-display > .katex {
    display: inline-block;
    text-align: initial;
}

/* Talking Page */
.talking {
    max-width: 800px;
}

.talking-list {
    list-style: none;
}

.talking-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.talking-item:last-child {
    border-bottom: none;
}

.talking-item h2 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.talking-item p {
    font-size: 14px;
    line-height: 1.625;
    color: var(--color-text);
}

.talking-item a {
    color: var(--color-text);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.talking-item a:hover {
    opacity: 0.6;
}

/* Working Page */
.working {
    max-width: 800px;
}

.working-list {
    list-style: none;
}

.working-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.working-item:last-child {
    border-bottom: none;
}

.working-item h2 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.working-item p {
    font-size: 14px;
    line-height: 1.625;
    color: var(--color-text);
}

.working-item a {
    color: var(--color-text);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.working-item a:hover {
    opacity: 0.6;
}

/* Favorites Page */
.favorites {
    max-width: 800px;
}

.favorites-list {
    list-style: none;
    margin-top: 2rem;
}

.favorites-item {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.favorites-item:last-child {
    border-bottom: none;
}

.favorites-item h2 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.favorites-item p {
    font-size: 14px;
    line-height: 1.625;
    color: var(--color-text);
}

.favorites-item a {
    color: var(--color-text);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.favorites-item a:hover {
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 768px) {
    .nav {
        padding: 1.5rem;
    }

    main {
        padding-top: 6rem;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}
