/* Tufte CSS - MIT License - https://edwardtufte.github.io/tufte-css/ */
/* Adapted and extended for The Covenanting Record */

@charset "UTF-8";

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&display=swap');

html {
    font-size: 15px;
}

body {
    width: 87.5%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 12.5%;
    font-family: 'EB Garamond', Georgia, serif;
    background-color: #fffff8;
    color: #111;
    max-width: 1400px;
    counter-reset: sidenote-counter;
    overflow-x: hidden;
}

/* Layout with sidebar */
body.has-sidebar {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    width: 100%;
    max-width: 100%;
}

.sidebar-body-wrap {
    display: flex;
    flex-direction: row;
    flex: 1;
}

body.has-sidebar .content-wrap {
    flex: 1;
    padding: 0 3rem;
    max-width: 820px;
}

/* Sidebar */
.sidebar {
    display: none;
    width: 240px;
    min-width: 240px;
    background-color: #f4f0e8;
    border-right: 1px solid #ccc8b8;
    padding: 2rem 1.2rem;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 0.95rem;
    height: calc(100vh - 60px);
    overflow-y: auto;
    position: sticky;
    top: 60px;
}

body.has-sidebar .sidebar {
    display: block;
}

.sidebar-title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ccc8b8;
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar ul li a {
    display: block;
    padding: 0.28rem 0.5rem;
    color: #444;
    text-decoration: none;
    border-radius: 2px;
    line-height: 1.4;
    font-size: 1rem;
}

.sidebar ul li a:hover {
    background-color: #e8e4d8;
    color: #111;
}

.sidebar ul li a.active {
    background-color: #ddd8c4;
    color: #111;
    font-style: italic;
}

.sidebar .section-heading {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
    padding-left: 0.5rem;
}

.sidebar ul ul {
    padding-left: 1rem;
}

/* Site Header */
.site-header {
    width: 100%;
    background-color: #fffff8;
    border-bottom: 1px solid #ccc8b8;
    padding: 0.8rem 2rem;
    display: flex;
    align-items: baseline;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-sizing: border-box;
    height: 60px;
}

.site-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.4rem;
    font-style: italic;
    color: #111;
    text-decoration: none;
}

.site-nav {
    margin-left: auto;
}

.site-nav a {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1rem;
    color: #555;
    text-decoration: none;
    margin-left: 1.5rem;
}

.site-nav a:hover {
    color: #111;
}

/* Content wrapper for non-sidebar pages */
.content-wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Typography */
h1 {
    font-weight: 400;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    font-size: 3rem;
    line-height: 1.1;
}

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

h3 {
    font-style: italic;
    font-weight: 400;
    font-size: 1.6rem;
    margin-top: 2rem;
    margin-bottom: 1.4rem;
}

hr {
    display: block;
    height: 1px;
    width: 55%;
    border: 0;
    border-top: 1px solid #ccc;
    margin: 2rem 0;
    padding: 0;
}

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

article {
    padding: 2rem 0;
}

section {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

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

p {
    margin-top: 1.4rem;
    margin-bottom: 1.4rem;
    padding-right: 0;
    vertical-align: baseline;
}

/* Blockquote and Scripture */
blockquote {
    font-size: 1.3rem;
    margin: 2rem 0;
    padding-left: 2rem;
    border-left: 3px solid #ccc8b8;
    color: #444;
}

blockquote p {
    margin-right: 40px;
}

.scripture {
    font-style: italic;
    border-left: 3px solid #b8a87a;
    padding-left: 1.5rem;
    color: #333;
    margin: 2rem 0;
    font-size: 1.4rem;
    line-height: 2rem;
}

.scripture cite {
    display: block;
    font-style: normal;
    font-size: 1rem;
    color: #888;
    margin-top: 0.6rem;
}

/* Sidenotes */
.sidenote,
.marginnote {
    float: right;
    clear: right;
    margin-right: -38%;
    width: 34%;
    margin-top: 0.3rem;
    margin-bottom: 0;
    font-size: 1.1rem;
    line-height: 1.5;
    vertical-align: baseline;
    position: relative;
    color: #666;
    max-width: 280px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

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

.sidenote-number:after,
.sidenote:before {
    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;
}

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

.margin-toggle {
    cursor: pointer;
}

input.margin-toggle {
    display: none;
}

/* Post list (blog index) */
.post-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.post-list li {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e8e4d8;
}

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

.post-list .post-title {
    font-size: 1.8rem;
    font-weight: 400;
    margin: 0 0 0.3rem 0;
}

.post-list .post-title a {
    color: #111;
    text-decoration: none;
}

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

.post-list .post-meta {
    font-size: 1rem;
    color: #888;
    font-style: italic;
    margin-bottom: 0.8rem;
}

.post-list .post-excerpt {
    font-size: 1.3rem;
    line-height: 1.8rem;
    color: #333;
}

/* Post / single article */
.post-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e8e4d8;
}

.post-header h1 {
    margin-top: 1rem;
    margin-bottom: 0.3rem;
}

.post-meta {
    font-size: 1.1rem;
    color: #888;
    font-style: italic;
}

.post-tags {
    margin-top: 0.6rem;
}

.post-tags .tag {
    font-size: 0.9rem;
    background: #e8e4d8;
    color: #555;
    padding: 0.1rem 0.5rem;
    border-radius: 2px;
    margin-right: 0.3rem;
    text-decoration: none;
    font-style: normal;
}

/* Comments section */
.comments-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #ccc8b8;
}

.comments-section h3 {
    font-size: 1.4rem;
    font-style: italic;
    font-weight: 400;
    margin-bottom: 1rem;
    color: #555;
}

/* Footer */
.site-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid #ccc8b8;
    font-size: 1rem;
    color: #888;
    text-align: center;
    font-style: italic;
}

/* Links */
a {
    color: #111;
    text-decoration: underline;
    text-decoration-color: #ccc8b8;
    text-underline-offset: 3px;
}

a:hover {
    text-decoration-color: #888;
}

/* Figures */
figure {
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
    max-width: 55%;
    margin: 0 0 3em 0;
}

figcaption {
    float: right;
    clear: right;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.1rem;
    line-height: 1.6;
    vertical-align: baseline;
    position: relative;
    max-width: 40%;
    color: #666;
}

/* Code */
code, pre {
    font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 1rem;
    line-height: 1.42;
}

pre {
    padding: 1rem 1.5rem;
    background: #f4f0e8;
    border-left: 3px solid #ccc8b8;
    overflow-x: auto;
}

/* Responsive */
@media (max-width: 800px) {
    body {
        width: 90%;
        padding-left: 5%;
        padding-right: 5%;
    }

    body.has-sidebar {
        flex-direction: column;
        padding-left: 0;
        width: 100%;
    }

    .sidebar-body-wrap {
        flex-direction: column;
    }

    body.has-sidebar .sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid #ccc8b8;
    }

    body.has-sidebar .content-wrap {
        padding: 1rem 1.5rem;
    }

    .sidenote, .marginnote {
        display: none;
    }

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

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

    figure {
        max-width: 100%;
    }
}

/* Sidenote containment for sidebar layout */
body.has-sidebar .sidenote,
body.has-sidebar .marginnote {
    margin-right: -32%;
    width: 28%;
    max-width: 220px;
}

/* Historical document title and preamble styles */
.document-title {
    font-size: 1.5rem;
    font-variant: small-caps;
    text-align: center;
    line-height: 2rem;
    margin: 2rem 0 1rem 0;
    font-style: normal;
    font-weight: 400;
    letter-spacing: 0.03em;
}

.document-preamble {
    font-style: italic;
    font-size: 1.2rem;
    line-height: 1.8rem;
    color: #444;
    margin: 1rem 0 2rem 0;
    padding: 1rem 1.5rem;
    border-left: 3px solid #ccc8b8;
}
