/* ET Book font faces */
@font-face {
    font-family: "ET Book";
    src: url("/fonts/et-book-roman.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "ET Book";
    src: url("/fonts/et-book-bold.woff2") format("woff2");
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "ET Book";
    src: url("/fonts/et-book-italic.woff2") format("woff2");
    font-weight: normal;
    font-style: italic;
    font-display: swap;
}

/* Base */
html {
    font-size: 15px;
}
body {
    font-family: "ET Book", Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
    color: #111;
    background: #f2f3f5;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    counter-reset: sidenote-counter;
}

/* Article layout — wide left column with margin for sidenotes */
article {
    width: 55%;
    padding: 5rem 0 2rem 5%;
}

/* Typography */
h1 {
    font-weight: 400;
    font-size: 3.2rem;
    line-height: 1.1;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
}
h2 {
    font-weight: 400;
    font-style: italic;
    font-size: 2.2rem;
    line-height: 1.2;
    margin-top: 3rem;
    margin-bottom: 0.8rem;
}
h3 {
    font-weight: 400;
    font-style: italic;
    font-size: 1.7rem;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 0.6rem;
}
p, ol, ul {
    font-size: 1.4rem;
    line-height: 2rem;
    margin-top: 1.4rem;
    margin-bottom: 0;
}
p {
    padding-right: 0;
    vertical-align: baseline;
}
a:link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: #aaa;
    text-underline-offset: 2px;
}
a:visited {
    color: inherit;
}
a:hover {
    text-decoration-color: #111;
}
blockquote {
    font-size: 1.4rem;
    margin: 1.5rem 0 1.5rem 0;
    padding-left: 2rem;
    border-left: 3px solid #ccc;
}
blockquote p {
    font-style: italic;
}

/* Subtitle / tagline */
p.subtitle {
    font-style: italic;
    font-size: 1.8rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    display: block;
    line-height: 1.4;
    color: #444;
}

/* Navigation */
nav {
    width: 55%;
    padding: 2rem 0 0 5%;
}
nav a, nav a:link, nav a:visited, nav a:hover, nav a:active {
    font-size: 1.2rem;
    margin-right: 1.8rem;
    text-decoration: none !important;
    color: #666;
    letter-spacing: 0.02em;
}
nav a:hover {
    color: #111;
}
nav a.active, nav a.active:link, nav a.active:visited, nav a.active:hover {
    color: #111;
    font-weight: bold;
}

/* Sidenotes and margin notes */
.sidenote, .marginnote {
    float: right;
    clear: right;
    margin-right: -60%;
    width: 50%;
    margin-top: 0.3rem;
    margin-bottom: 0;
    font-size: 1.1rem;
    line-height: 1.3;
    vertical-align: baseline;
    position: relative;
}
.sidenote-number {
    counter-increment: sidenote-counter;
}
.sidenote-number:after, .sidenote:before {
    font-family: "ET Book", Palatino, serif;
    position: relative;
    vertical-align: baseline;
}
.sidenote-number:after {
    content: counter(sidenote-counter);
    font-size: 1rem;
    top: -0.5rem;
    left: 0.1rem;
}
.sidenote:before {
    content: counter(sidenote-counter) " ";
    font-size: 1rem;
    top: -0.5rem;
}
input.margin-toggle { display: none; }
label.sidenote-number { cursor: pointer; }
label.margin-toggle:not(.sidenote-number) { display: none; }

/* Code */
code {
    font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 1.125rem;
    background: #f0f0e8;
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
}
pre {
    font-size: 1.1rem;
    line-height: 1.5;
    overflow-x: auto;
    padding: 1rem 1.5rem;
    background: #f0f0e8;
    border-radius: 3px;
    margin: 1.5rem 0;
}
pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* Figures and images */
figure {
    max-width: 55%;
    margin: 2rem 0;
}
figure img {
    max-width: 100%;
}
figcaption {
    font-size: 1.1rem;
    line-height: 1.5;
    margin-top: 0.5rem;
    color: #666;
}
img.photo {
    width: 500px;
    height: 500px;
    border-radius: 4px;
    float: right;
    clear: right;
    margin-right: -85%;
    margin-top: -5rem;
    margin-bottom: 1rem;
}

/* Margin figures — in margin on desktop, inline on mobile */
figure.margin-figure {
    float: right;
    clear: right;
    margin-right: -60%;
    width: 50%;
    margin-top: 0;
    margin-bottom: 1rem;
}
figure.margin-figure img {
    width: 100%;
}

/* Tables */
table {
    border-collapse: collapse;
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 1.5rem 0;
    width: 100%;
}
th, td {
    padding: 0.4rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}
th {
    font-weight: bold;
    border-bottom: 2px solid #111;
}

/* Horizontal rule */
hr {
    border: 0;
    border-top: 1px solid #ccc;
    margin: 3rem 0;
}

/* Footer */
footer {
    width: 55%;
    padding: 2rem 0 3rem 5%;
    font-size: 1.1rem;
    color: #888;
    border-top: 1px solid #ddd;
    margin-top: 3rem;
}
footer a {
    color: #888;
}

/* Project cards */
section.project {
    margin-bottom: 2.5rem;
}
section.project h3 {
    margin-bottom: 0.3rem;
}
section.project p {
    margin-top: 0.5rem;
}

/* CV page */
.cv h2 {
    margin-top: 2.5rem;
    font-size: 1.8rem;
}
.cv h3 {
    font-size: 1.4rem;
    margin-top: 1.5rem;
}
.cv ul {
    margin-top: 0.5rem;
}
.cv li {
    margin-bottom: 0.4rem;
    font-size: 1.3rem;
    line-height: 1.7;
}

/* Writing list */
.writing-list {
    list-style: none;
    padding: 0;
}
.writing-list li {
    margin-bottom: 1.5rem;
}
.writing-list .date {
    font-size: 1.1rem;
    color: #888;
    display: block;
}
.writing-list a {
    font-size: 1.4rem;
}

/* Mobile */
@media (max-width: 900px) {
    article, nav, footer {
        width: auto;
        padding-left: 5%;
        padding-right: 5%;
    }
    article {
        padding-top: 2rem;
    }
    h1 {
        margin-top: 1rem;
    }
    .sidenote, .marginnote {
        display: none;
    }
    label.margin-toggle:not(.sidenote-number) {
        display: inline;
        cursor: pointer;
        color: #888;
    }
    input.margin-toggle:checked + .sidenote,
    input.margin-toggle:checked + .marginnote {
        display: block;
        float: left;
        left: 1rem;
        clear: both;
        width: 95%;
        margin: 1rem 2.5%;
        position: relative;
    }
    img.photo {
        float: none;
        display: block;
        width: 200px;
        height: 200px;
        margin: 0 auto 1rem auto;
    }
    figure.margin-figure {
        float: none;
        width: 80%;
        margin: 1.5rem auto;
    }
    figure.margin-figure figcaption {
        text-align: center;
    }
}

/* Elsewhere links */
.elsewhere {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
}
.elsewhere li {
    font-size: 1.4rem;
    line-height: 2rem;
}
.elsewhere li img.icon {
    width: 1.2rem;
    height: 1.2rem;
    vertical-align: -0.1rem;
    margin-right: 0.5rem;
    opacity: 0.7;
}

/* Project grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}
.project-card, .project-card:link, .project-card:visited {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
}
.project-card:hover {
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.project-card-image {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: #e8e8e8;
}
.project-card-no-image {
    background: linear-gradient(135deg, #e0e0e0, #ccc);
}
.project-card-image-dark {
    background-color: #e8e8e8;
}
.project-card-body {
    padding: 1rem 1.2rem;
}
.project-card-body h3 {
    font-size: 1.3rem;
    font-style: normal;
    font-weight: 400;
    margin: 0 0 0.3rem 0;
}
.project-card-body p {
    font-size: 1.1rem;
    line-height: 1.5;
    margin: 0.3rem 0 0 0;
    color: #444;
}
.project-card-tech {
    font-size: 1rem !important;
    color: #888 !important;
    font-style: italic;
    margin: 0 !important;
}

/* Print */
@media print {
    body { font-size: 12pt; }
    nav, footer { display: none; }
    article { width: 100%; padding: 0; }
    .sidenote, .marginnote {
        float: none;
        margin: 0.5em 0;
        width: auto;
        font-size: 0.9em;
        color: #666;
    }
    a { text-decoration: none; color: #111; }
}
