/* Minimal writing site styling inspired by Tufte CSS */

* {
    box-sizing: border-box;
}

body {
    font-family: "Palatino Linotype", Palatino, serif;
    font-size: 16px;
    line-height: 1.6;
    color: #111;
    background: #fff;
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
}

a {
    color: #1a365d;
    text-decoration: underline;
}

a:hover {
    color: #2c5aa0;
}

header {
    margin-bottom: 2rem;
}

.site-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.site-title a {
    color: #666;
    text-decoration: none;
}

.site-title a:hover {
    color: #111;
    text-decoration: underline;
}

.page-title {
    font-size: 2rem;
    font-weight: normal;
    margin-top: 0;
    margin-bottom: 1rem;
}

.breadcrumb {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: #666;
}

.breadcrumb a {
    color: #666;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #111;
    text-decoration: underline;
}

.breadcrumb::before {
    content: "← ";
}

h1, h2, h3, h4 {
    font-weight: normal;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

nav a {
    margin-right: 1rem;
    text-decoration: none;
    color: #111;
}

nav a:hover {
    text-decoration: underline;
}

.post-list {
    margin-bottom: 3rem;
}

.post-entry {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.post-entry:last-child {
    border-bottom: none;
}

.post-entry time {
    display: block;
    font-family: monospace;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.post-entry a {
    color: #111;
    text-decoration: none;
    font-weight: bold;
}

.post-entry a:hover {
    text-decoration: underline;
}

.post-entry p {
    margin: 0.5rem 0;
    color: #555;
    font-style: italic;
}

/* Sidenotes and footnotes */
.sidenote, .marginnote {
    float: right;
    clear: right;
    margin-right: -200px;
    width: 190px;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 0.8rem;
    line-height: 1.3;
    vertical-align: baseline;
    position: relative;
}

article {
    counter-reset: sidenote-counter 0;
}

label.sidenote-number {
    counter-increment: sidenote-counter;
}

.sidenote-number:after,
.sidenote:before {
    font-family: et-book-roman-old-style;
    position: relative;
    vertical-align: baseline;
}

.sidenote-number:after {
    content: counter(sidenote-counter);
    font-size: 0.7rem;
    top: -0.5rem;
    left: 0.1rem;
}

.sidenote:before {
    content: counter(sidenote-counter) " ";
    font-size: 0.7rem;
    top: -0.5rem;
}

blockquote .sidenote,
blockquote .marginnote {
    margin-right: -24vw;
    width: 18vw;
}

input.margin-toggle {
    display: none;
}

label.sidenote-number {
    display: inline;
}

label.margin-toggle:not(.sidenote-number) {
    display: none;
}

/* Mobile responsiveness */
@media (max-width: 760px) {
    body {
        padding: 15px;
    }

    .sidenote, .marginnote {
        display: none;
    }

    .margin-toggle:checked + .sidenote,
    .margin-toggle:checked + .marginnote {
        display: block;
        float: left;
        left: 1rem;
        clear: both;
        width: 95%;
        margin: 1rem 2.5%;
        vertical-align: baseline;
        position: relative;
    }

    label.margin-toggle:not(.sidenote-number) {
        display: inline;
        color: #a00;
        cursor: pointer;
    }
}

footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.9rem;
    color: #666;
}

footer a {
    color: #666;
}

/* Math rendering */
.katex {
    font-size: 1em;
}

/* Code blocks */
pre, code {
    font-family: "Courier New", monospace;
    background: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

pre {
    padding: 1em;
    overflow-x: auto;
    margin: 1rem 0;
}

/* Landing page styles */
body.landing {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    justify-content: center;
    align-items: center;
    text-align: center;
    max-width: 500px;
}

.landing-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 500px;
    width: 100%;
}

.centerpiece {
    margin-bottom: 2rem;
}

.profile-image {
    max-width: 700px;
    height: auto;
    border-radius: 0;
    object-fit: cover;
}

.main-nav {
    margin-bottom: 2rem;
}

.main-nav a {
    display: inline-block;
    margin: 0 1rem;
    padding: 0.5rem 0;
    text-decoration: none;
    color: #111;
    font-size: 1.1rem;
    border-bottom: 2px solid transparent;
    transition: border-bottom-color 0.2s ease;
}

.main-nav a:hover {
    border-bottom-color: #111;
    text-decoration: none;
}

.landing-footer {
    margin-top: auto;
    padding: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.landing-footer a {
    color: #666;
}

/* Additional styles for new pages */
.talk-entry {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.talk-entry:last-child {
    border-bottom: none;
}

.talk-entry h3 {
    margin-bottom: 0.5rem;
}

/* Mobile responsiveness for landing page */
@media (max-width: 760px) {
    .main-nav a {
        display: block;
        margin: 0.5rem 0;
    }

    .profile-image {
        max-width: 450px;
    }
}

/* Demo box for interactive examples */
.demo-box {
    border: 1px solid #ccc;
    padding: 20px;
    margin: 20px 0;
    background: #f9f9f9;
}

/* Figure images */
figure img {
    width: 100%;
    max-width: 700px;
    height: auto;
}