/* Tufte CSS - Matching siboehm.com exactly */

@font-face {
    font-family: "et-book";
    src: url("https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;600;700&display=swap");
}

/* Use system serif fonts as fallback since we can't host et-book */
*, *:before, *:after {
    margin: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

.group:after {
    content: "";
    display: table;
    clear: both;
}

.mathblock, .MJXc-display {
    font-size: 1.1rem !important;
    clear: left;
    margin: 1rem 0;
    line-height: 1.6;
}

.mathblock {
    overflow-x: auto;
    overflow-y: hidden;
}

html {
    font-size: 10px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media screen and (min-width: 800px) {
    html { font-size: 11px; }
}

@media screen and (min-width: 900px) {
    html { font-size: 12px; }
}

@media screen and (min-width: 1000px) {
    html { font-size: 13px; }
}

@media screen and (min-width: 1100px) {
    html { font-size: 14px; }
}

body {
    width: 100%;
    padding-left: 11%;
    max-width: calc(12.5% + 1350px);
    margin: 0 auto;
    font-family: "EB Garamond", "Palatino", "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
    background-color: #f7f5f2;
    color: #1f1f1f;
    counter-reset: sidenote-counter;
}

h1 {
    font-weight: 500;
    margin-top: 1.6rem;
    margin-bottom: 1.5rem;
    font-size: 2.6rem;
    line-height: 1.2;
    color: #2c2c2c;
}

h2 {
    font-style: normal;
    font-weight: 500;
    margin-top: 1.9rem;
    margin-bottom: 0.2rem;
    font-size: 2.15rem;
    line-height: 1.0;
    color: #2a2a2a;
}

h3 {
    font-style: italic;
    font-weight: 400;
    font-size: 1.8rem;
    margin-top: 2.1777777777777778rem;
    margin-bottom: 0;
    line-height: 1.08888888888889;
    color: #2d2d2d;
}

p .subtitle {
    font-style: italic;
    margin-top: 2.1777777777777778rem;
    margin-bottom: 2.1777777777777778rem;
    font-size: 1.8rem;
    display: block;
    line-height: 1.08888888888889;
}

article {
    width: 57%;
    position: relative;
    padding: 4.5rem 0;
}

p, ol, ul {
    font-size: 1.4rem;
    line-height: 2rem;
    margin: 1.4rem 0;
}

p {
    padding-right: 0;
    vertical-align: baseline;
    text-align: justify;
}

/* Alignment variations */
p.lead {
    font-size: 1.5rem;
    line-height: 2.2rem;
    text-align: left;
    margin-bottom: 2rem;
}

p.center {
    text-align: center;
}

p.right {
    text-align: right;
}

li {
    margin-bottom: 0.5em;
}

ol, ul {
    padding-left: 6%;
}

blockquote p, pre {
    padding-right: 0 10%;
}

blockquote * {
    font-size: 1.1rem;
}

blockquote p {
    line-height: 1.75rem;
}

blockquote footer {
    text-align: right;
}

figure.maincolumn {
    margin-bottom: 3em;
}

figure.maincolumn > figcaption {
    display: block !important;
}

figure.fullwidth figcaption {
    float: left;
    margin-right: 0%;
    margin-left: 36%;
}

img {
    max-width: 100%;
}

.sidenote, .marginnote {
    width: 24.0625vw;
    max-width: 336.875px;
    margin-right: -60%;
    float: right;
    clear: right;
    font-size: 1rem;
    margin-top: 0;
    margin-bottom: 1.4rem;
    line-height: 1.4;
    vertical-align: baseline;
    position: relative;
    text-align: start;
}

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

.sidenote-number:after, .sidenote:before {
    font-family: "EB Garamond", "Palatino", serif;
    color: #c41e3a;
    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) ". ";
}

blockquote .sidenote, blockquote .marginnote {
    margin-right: -82.35%;
}

li .sidenote, li .marginnote {
    margin-right: -63.29%;
}

input.margin-toggle {
    display: none;
}

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

a {
    color: #b80000;
    text-decoration: none;
}

p > a:link, p > a:visited {
    color: inherit;
}

p > a:link {
    background: -webkit-linear-gradient(#f7f5f2, #f7f5f2), -webkit-linear-gradient(#f7f5f2, #f7f5f2), -webkit-linear-gradient(#333, #333);
    background: linear-gradient(#f7f5f2, #f7f5f2), linear-gradient(#f7f5f2, #f7f5f2), linear-gradient(#333, #333);
    -webkit-background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
    -moz-background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
    background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
    background-repeat: no-repeat, no-repeat, repeat-x;
    text-shadow: 0.03em 0 #f7f5f2, -0.03em 0 #f7f5f2, 0 0.03em #f7f5f2, 0 -0.03em #f7f5f2, 0.06em 0 #f7f5f2, -0.06em 0 #f7f5f2, 0.09em 0 #f7f5f2, -0.09em 0 #f7f5f2, 0.12em 0 #f7f5f2, -0.12em 0 #f7f5f2, 0.15em 0 #f7f5f2, -0.15em 0 #f7f5f2;
    background-position: 0% 93%, 100% 93%, 0% 93%;
}

@media screen and (-webkit-min-device-pixel-ratio: 0) {
    p > a:link {
        background-position-y: 87%, 87%, 87%;
    }
}

pre, code {
    font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 1rem;
    line-height: 1.42;
    border-radius: 4px;
    margin-top: 1.42rem;
}

pre {
    overflow-x: auto;
}

pre.highlight {
    background: #ffffff;
    border: gray 1.5px solid;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 1.42rem;
    margin-bottom: 1.42rem;
}

code {
    background: #f5f5f5;
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

pre code {
    background: transparent;
    padding: 0;
}

.sans {
    font-family: "Gill Sans", "Gill Sans MT", "Lato", Calibri, sans-serif;
    letter-spacing: .03em;
}

.fullwidth {
    max-width: 90%;
}

.full-width .sidenote, .full-width .sidenote-number, .full-width .marginnote {
    display: none;
}

span.newthought {
    font-variant: small-caps;
    font-size: 1.2em;
    letter-spacing: 0.05rem;
}

table.booktabs {
    width: auto;
    margin: 1.5rem auto;
    border-spacing: 0px;
    border-top: 2px solid #2d2d2d;
    border-bottom: 2px solid #2d2d2d;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

th, .booktabs th {
    border-bottom: 1.5px solid #2d2d2d;
    padding: 0.75ex 0.6em 0.5ex 0.6em;
    font-weight: 500;
    text-align: center;
    background-color: #f5f3ef;
}

th, td {
    font-size: 1.2rem;
    line-height: 1.71428571;
}

th, .booktabs th.cmid {
    border-bottom: 1px solid #737373;
}

.booktabs th.nocmid {
    border-bottom: none;
}

tr:first-child td, .booktabs tbody tr:first-child td {
    padding-top: 0.65ex;
}

td, .booktabs td {
    padding-left: 0.6em;
    padding-right: 0.6em;
    padding-top: 0.4em;
    padding-bottom: 0.4em;
    text-align: right;
}

table tbody td:nth-child(1) {
    text-align: left;
}

table tbody tr:nth-child(odd) {
    background-color: #f3f1ed;
}

table tbody tr:hover {
    background-color: #edeae5;
    transition: background-color 0.2s ease;
}

caption, .booktabs caption {
    font-size: 90%;
    text-align: left;
    width: auto;
    margin-left: auto;
    margin-right: auto;
    margin-top: 1ex;
    caption-side: top;
}

.booktabs tbody tr td.l {
    text-align: left !important;
}

.booktabs tbody tr td.c {
    text-align: center !important;
}

.booktabs tbody tr td.r {
    text-align: right !important;
}

.table-caption {
    float: right;
    clear: right;
    margin-right: -60%;
    width: 50%;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.0rem;
    line-height: 1.96;
}

@media screen and (max-width: 760px) {
    article {
        width: 90%;
    }
    figure {
        max-width: 90%;
    }
    figcaption, figure.fullwidth figcaption {
        margin-right: 0%;
        max-width: none;
    }
    blockquote p, blockquote footer {
        padding-right: 10%;
    }
}

@media (max-width: 760px) {
    label.margin-toggle:not(.sidenote-number) {
        display: inline;
        color: #b80000;
    }
    blockquote .sidenote, blockquote .marginnote, li .sidenote, li .marginnote, .sidenote, .marginnote {
        width: 100%;
        max-width: 100%;
        display: none;
        float: left;
        padding: 0 5%;
        margin: 1rem 0;
        vertical-align: baseline;
    }
    .margin-toggle:checked + .sidenote, .margin-toggle:checked + .marginnote {
        display: block;
    }
    label {
        cursor: pointer;
    }
    .table-caption {
        display: block;
        float: right;
        clear: both;
        width: 98%;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
        margin-left: 1%;
        margin-right: 1%;
        vertical-align: baseline;
        position: relative;
    }
    div.table-wrapper, table, table.booktabs {
        width: 85%;
    }
}

.contrast {
    color: #c41e3a;
}

.smaller {
    font-size: 80%;
}

header > nav.group, body footer {
    width: 95%;
    padding-top: 2rem;
}

nav.group a.active:before {
    content: "";
}

nav.group a.active:after {
    content: "";
}

header > nav a {
    font-size: 1.15rem;
    font-family: "Gill Sans", "Gill Sans MT", "Lato", Calibri, sans-serif;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #c41e3a;
    padding-top: 1.6rem;
    display: inline-block;
    float: left;
    margin-top: 0;
    margin-bottom: 0;
    padding-right: 2.2rem;
    vertical-align: baseline;
}

ul.footer-links, .credits {
    list-style: none;
    text-align: center;
    margin: 0 auto;
}

ul.footer-links li {
    display: inline;
    padding: 0.5rem 0.25rem;
}

.credits {
    padding: 1rem 0rem;
}

.credits {
    font-family: "Gill Sans", "Gill Sans MT", "Lato", Calibri, sans-serif;
}

.credits a {
    color: #c41e3a;
}

body.full-width {
    width: 90%;
    margin-left: auto;
    margin-right: auto;
    padding: 0% 5%;
}

.full-width article p {
    width: 90%;
}

h1.content-listing-header {
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    font-size: 1.8rem;
}

li.listing hr {
    width: 100%;
}

.listing, .listing h3 {
    display: inline-block;
    margin: 0;
}

li.listing {
    margin: 0;
}

li.listing p {
    width: 100%;
}

hr.slender {
    border: 0;
    height: 1px;
    margin-top: 1.4rem;
    margin-bottom: 1.4rem;
    background-image: -webkit-linear-gradient(left, transparent, rgba(0,0,0,0.75), transparent);
    background-image: -moz-linear-gradient(left, transparent, rgba(0,0,0,0.75), transparent);
    background-image: -ms-linear-gradient(left, transparent, rgba(0,0,0,0.75), transparent);
    background-image: -o-linear-gradient(left, transparent, rgba(0,0,0,0.75), transparent);
}

hr.invisible {
    border: 0;
    height: 1px;
    margin-top: 1.4rem;
    margin-bottom: 1.4rem;
}

/* KaTeX styling */
.katex {
    font-size: 1em !important;
}

.katex-display {
    font-size: 1.1em !important;
    margin: 1rem 0 !important;
}

/* Inline math should match text size */
.katex:not(.katex-display) {
    font-size: 1em !important;
}

/* Math blocks */
.mathblock .katex-display {
    font-size: 1.1em !important;
}

.mathblock {
    font-size: 1.1rem;
    margin: 1rem 0;
}

/* Syntax highlighting */
.highlight {
    margin-bottom: 1.5rem;
    background: #faf8f5;
}

/* References and citations - styled as sidenotes/marginnotes */
.reference-note {
    width: 24.0625vw;
    max-width: 336.875px;
    margin-right: -60%;
    float: right;
    clear: right;
    font-size: 1rem;
    margin-top: 0;
    margin-bottom: 1.4rem;
    line-height: 1.4;
    vertical-align: baseline;
    position: relative;
    text-align: start;
    padding-left: 0.8rem;
    border-left: 1px solid #c8c4c0;
}

.reference-note a {
    color: #c41e3a;
}

.reference-note a:hover {
    text-decoration: underline;
}

/* Inline citations */
cite {
    font-style: italic;
    color: #666;
}

sup {
    font-size: 0.75em;
    vertical-align: super;
    color: #c41e3a;
    margin-left: 0.2em;
}

sup a {
    color: #c41e3a;
    text-decoration: none;
}

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

/* Responsive: hide reference notes in margin on small screens */
@media screen and (max-width: 760px) {
    .reference-note {
        width: 100%;
        max-width: 100%;
        float: none;
        margin-right: 0;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid #c8c4c0;
        padding-top: 0.5rem;
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
}

.highlight pre {
    background: #ffffff;
    border: gray 1.5px solid;
    padding: 0.5rem;
}

/* Post meta styling */
.post-meta {
    text-align: right;
    font-size: 1.4rem;
    line-height: 2rem;
    margin-bottom: 1.4rem;
}

/* Content listing */
ul.content-listing {
    list-style: none;
    padding: 0;
}

ul.content-listing li {
    margin-bottom: 2rem;
}

ul.content-listing h2 {
    margin-bottom: 0.5rem;
}

ul.content-listing h2 a {
    color: #1a1a1a;
}

ul.content-listing h2 a:hover {
    color: #c41e3a;
}

/* Subscription form */
.subscribe-section {
    margin: 2rem 0;
    padding: 1.5rem 0;
    text-align: center;
    scroll-margin-top: 2rem; /* Add space when scrolling to anchor */
}

.subscribe-section p {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.subscribe-form {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.subscribe-form input[type="email"] {
    padding: 0.6rem 1rem;
    font-size: 1.1rem;
    font-family: "EB Garamond", "Palatino", serif;
    border: 1px solid #c8c4c0;
    border-radius: 4px;
    background-color: #fff;
    color: #1f1f1f;
    min-width: 250px;
    max-width: 100%;
}

.subscribe-form input[type="email"]:focus {
    outline: none;
    border-color: #c41e3a;
    box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.1);
}

.subscribe-form button {
    padding: 0.6rem 1.5rem;
    font-size: 1.1rem;
    font-family: "Gill Sans", "Gill Sans MT", "Lato", Calibri, sans-serif;
    background-color: #c41e3a;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.subscribe-form button:hover {
    background-color: #a0182d;
}

.subscribe-form button:active {
    background-color: #8a1526;
}

.subscribe-note {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
    font-style: italic;
}

@media screen and (max-width: 600px) {
    .subscribe-form {
        flex-direction: column;
    }
    
    .subscribe-form input[type="email"] {
        width: 100%;
        min-width: auto;
    }
    
    .subscribe-form button {
        width: 100%;
    }
}
