/* 
 * Tufte Lite CSS
 * A simplified version of Tufte CSS maintaining the aesthetic with minimal markup
 * Based on Tufte CSS by Dave Liepmann and Edward Tufte
 */

@charset "UTF-8";

/* Import ET Book fonts - you'll still need the et-book font directory */
@font-face {
    font-family: "et-book";
    src: url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot");
    src: url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot?#iefix") format("embedded-opentype"), 
         url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff") format("woff"), 
         url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf") format("truetype"), 
         url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.svg#etbookromanosf") format("svg");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "et-book";
    src: url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot");
    src: url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot?#iefix") format("embedded-opentype"), 
         url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff") format("woff"), 
         url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf") format("truetype"), 
         url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.svg#etbookromanosf") format("svg");
    font-weight: normal;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "et-book";
    src: url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot");
    src: url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot?#iefix") format("embedded-opentype"), 
         url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff") format("woff"), 
         url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf") format("truetype"), 
         url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.svg#etbookromanosf") format("svg");
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* Base Typography */
html {
    font-size: 15px;
}

body {
    width: 87.5%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 12.5%;
    font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
    background-color: #fffff8;
    color: #111;
    max-width: 1400px;
    line-height: 1.4;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #151515;
        color: #ddd;
    }
    
    code {
        background-color: #2a2a2a !important;
        color: #ddd;
    }
    
    pre {
        background-color: #2a2a2a !important;
    }
    
    blockquote {
        border-left-color: #555;
    }
    
    blockquote::before {
        color: rgba(255, 255, 255, 0.08);
    }
}

/* Headers */
h1 {
    font-weight: 400;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    font-size: 3.2rem;
    line-height: 1;
}

h2 {
    font-style: italic;
    font-weight: 400;
    margin-top: 2.1rem;
    margin-bottom: 1.4rem;
    font-size: 2.2rem;
    line-height: 1;
}

h3 {
    font-style: italic;
    font-weight: 400;
    font-size: 1.7rem;
    margin-top: 2rem;
    margin-bottom: 1.4rem;
    line-height: 1;
}

/* Main content containers */
article {
    padding: 2rem 0;
}

section {
    padding-top: 1rem;
    padding-bottom: 1rem;
    width: 55%;
    /* Allow direct text without p tags */
    line-height: 2rem;
    font-size: 1.4rem;
}

/* Paragraphs and text */
p {
    font-size: 1.4rem;
    line-height: 2rem;
    margin-top: 1.4rem;
    margin-bottom: 1.4rem;
    padding-right: 0;
    vertical-align: baseline;
}

/* Make first paragraph after header not have top margin */
h1 + p, h2 + p, h3 + p {
    margin-top: 0.5rem;
}

/* Links */
a:link, a:visited {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.1em;
    text-decoration-thickness: 0.05em;
}

a:hover {
    text-decoration-thickness: 0.1em;
}

/* Blockquotes - Fancy with decorative quotes */
blockquote {
    font-size: 1.4rem;
    font-style: italic;
    margin: 2em 0;
    padding-left: 1em;
    border-left: 2px solid #ddd;
    width: 55%;
    position: relative;
    z-index: 1;
    overflow: visible;
}

blockquote::before {
    content: '\201D'; /* Closing quote character */
    position: absolute;
    top: -2rem;
    left: -1rem;
    font-family: Georgia, serif;
    font-size: 12rem;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.08);
    z-index: -1;
    line-height: 1;
    pointer-events: none;
    transform: scaleX(-1); /* Mirror horizontally */
}

blockquote p {
    width: 100%;
    margin-right: 0;
}

blockquote footer {
    font-style: normal;
    font-size: 1.1rem;
    text-align: right;
    margin-top: 1rem;
    width: 100%;
}

blockquote cite {
    font-style: italic;
}

/* Lists */
ul, ol {
    font-size: 1.4rem;
    line-height: 2rem;
    margin-top: 1.4rem;
    margin-bottom: 1.4rem;
    width: 50%;
    padding-left: 5%;
}

li {
    margin-bottom: 0.5rem;
}

/* Images and figures */
img {
    max-width: 100%;
    height: auto;
}

figure {
    margin: 2em 0;
    padding: 0;
    max-width: 55%;
}

figure.fullwidth {
    max-width: 90%;
}

figure img {
    margin-bottom: 0.5rem;
}

figcaption {
    font-size: 1.1rem;
    font-style: italic;
    margin-top: 0.5rem;
    color: #555;
}

/* The simplified margin notes */
.margin, aside {
    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;
}

/* Allow nesting of elements in margin notes */
.margin p, aside p {
    font-size: 1.1rem;
    line-height: 1.3;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.margin p:first-child, aside p:first-child {
    margin-top: 0;
}

/* Code styling */
code {
    font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.9em;
    background-color: #f5f5f5;
    padding: 0.125em 0.25em;
    border-radius: 2px;
}

pre {
    overflow-x: auto;
    padding: 1em;
    background-color: #f5f5f5;
    border-radius: 3px;
    margin: 1.4rem 0;
    width: 52.5%;
}

pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.42;
}

pre.fullwidth {
    width: 90%;
}

/* Horizontal rules */
hr {
    border: 0;
    border-top: 1px solid #ccc;
    margin: 2em 0;
    width: 55%;
}

/* Utility classes */
.subtitle {
    font-style: italic;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    display: block;
    line-height: 1;
}

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

.fullwidth {
    max-width: 90%;
    clear: both;
    width: 90%;
}

/* Full bleed - breaks out to 100% screen width */
.fullbleed {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    max-width: none;
    clear: both;
}

/* Ensure full bleed images scale properly */
.fullbleed img {
    width: 100%;
    height: auto;
    display: block;
}

/* Full bleed tables need special handling */
.fullbleed table {
    width: 100%;
    max-width: none;
}

/* Add some padding for text content in fullbleed */
.fullbleed > *:not(img):not(figure) {
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Simpler fullbleed that's more predictable */
.fullbleed-simple {
    margin-left: calc(-12.5% - ((100vw - 87.5%) / 2));
    margin-right: calc(-12.5% - ((100vw - 87.5%) / 2));
    width: auto;
    max-width: none;
}

.fullbleed-vs {
    margin: 0 -999px;
    padding: 0 999px;
    overflow-x: hidden;
}

.newthought {
    font-variant: small-caps;
    font-size: 1.2em;
}

/* Tables */
table {
    font-size: 1.2rem;
    width: 55%;
    margin: 1.4rem 0;
    border-collapse: collapse;
}

th {
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    padding: 0.5em 0.5em 0.5em 0;
    text-align: left;
}

td {
    padding: 0.5em 0.5em 0.5em 0;
    border-bottom: 1px solid #eee;
}

/* Epigraphs (if you use them) */
div.epigraph {
    margin: 3em 0;
}

div.epigraph > blockquote {
    margin-top: 1em;
    margin-bottom: 1em;
    font-style: italic;
}

div.epigraph > blockquote > footer {
    font-style: normal;
}

/* Mobile responsive */
@media (max-width: 760px) {
    body {
        width: 84%;
        padding-left: 8%;
        padding-right: 8%;
    }
    
    section, figure, blockquote, pre, table, hr, ul, ol {
        width: 100%;
    }
    
    blockquote {
        margin-left: 0;
        padding-left: 1em;
    }
    
    /* On mobile, margin notes become distinct boxes */
    .margin, aside {
        float: none;
        width: 100%;
        margin: 1.5rem 0;
        padding: 1rem;
        background-color: #f5f5f5;
        border-left: 3px solid #ddd;
        border-radius: 3px;
        font-size: 0.95rem;
    }
    
    /* Adjust quote size on mobile */
    blockquote::before {
        font-size: 10rem;
        left: -2rem;
        top: -1.5rem;
    }
    
    @media (prefers-color-scheme: dark) {
        .margin, aside {
            background-color: #2a2a2a;
            border-left-color: #555;
        }
    }
    
    pre {
        padding: 0.5em;
        font-size: 0.8rem;
    }
}

/* Print styles */
@media print {
    body {
        width: 100%;
        padding-left: 0;
        font-size: 12pt;
    }
    
    .margin, aside {
        float: right;
        clear: right;
        margin-right: -25%;
        width: 20%;
        font-size: 10pt;
    }
}