/* whitepapers.xyz — Garamond Classic System
   Documentation Clean Slate aesthetic.
   Tufte-inspired sidenote layout, 520px column, 18px serif body.
*/

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background-color: #FFFFFF;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    background-color: #FFFFFF;
    color: #333333;
    font-family: "EB Garamond", "Garamond", "Adobe Garamond Pro", Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.78;
    overflow-x: hidden;
}

/* -----------------------------------------------------------
   Reading progress bar (the single permitted ornament)
   ----------------------------------------------------------- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background-color: #B71C1C;
    z-index: 100;
    transition: width 80ms linear;
}

/* -----------------------------------------------------------
   Running header
   ----------------------------------------------------------- */
.running-header {
    position: fixed;
    top: 2px;
    left: 0;
    right: 0;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.96);
    border-bottom: 0.67px solid #999999;
    z-index: 90;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 220ms ease, transform 220ms ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.running-header.visible {
    opacity: 1;
    transform: translateY(0);
}

.running-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 32px;
    font-family: "Source Sans 3", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #666666;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.running-header-doc {
    flex: 0 0 auto;
}

.running-header-chapter {
    flex: 1 1 auto;
    text-align: center;
    color: #222222;
    font-weight: 500;
    transition: opacity 200ms ease;
}

.running-header-chapter.fading {
    opacity: 0;
}

.running-header-page {
    flex: 0 0 auto;
    font-variant-numeric: oldstyle-nums;
    font-feature-settings: "onum";
}

/* -----------------------------------------------------------
   Document container & grid
   ----------------------------------------------------------- */
.document {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 80px 32px 160px;
}

/* The Tufte three-zone grid:
   left margin (decoration / chapter labels),
   main column (520px text),
   right margin (sidenotes & figures).
   We use a CSS grid with named tracks to make the layout explicit.
*/
.chapter,
.colophon,
.title-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 520px minmax(0, 1fr);
    column-gap: 48px;
}

/* -----------------------------------------------------------
   Title page
   ----------------------------------------------------------- */
.title-page {
    min-height: 100vh;
    align-content: center;
    padding: 120px 0 160px;
}

.title-page-frame {
    grid-column: 2;
    text-align: center;
    padding: 24px 0;
}

.title-page-meta {
    font-family: "Source Sans 3", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 12px;
    color: #666666;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 80px;
    line-height: 1.8;
}

.title-page-meta-line {
    display: block;
}

.document-title {
    font-family: "EB Garamond", "Garamond", Georgia, serif;
    font-weight: 500;
    font-size: 48px;
    line-height: 1.18;
    color: #111111;
    letter-spacing: 0.02em;
    margin-bottom: 32px;
    font-style: normal;
}

.document-subtitle {
    font-family: "EB Garamond", Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 20px;
    line-height: 1.55;
    color: #444444;
    margin-bottom: 56px;
}

.title-page-rule {
    width: 80px;
    height: 0.67px;
    background-color: #999999;
    margin: 32px auto;
}

.title-page-rule.double {
    height: 4.67px;
    background: linear-gradient(
        to bottom,
        #999999 0,
        #999999 0.67px,
        transparent 0.67px,
        transparent 4px,
        #999999 4px,
        #999999 4.67px
    );
    background-color: transparent;
}

.title-page-byline {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 24px;
    row-gap: 8px;
    max-width: 380px;
    margin: 32px auto 40px;
    text-align: left;
    font-family: "Source Sans 3", "Inter", sans-serif;
    font-size: 13px;
    color: #666666;
}

.title-page-byline dt {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 11px;
    color: #999999;
    text-align: right;
    padding-top: 1px;
}

.title-page-byline dd {
    color: #333333;
    font-family: "EB Garamond", Georgia, serif;
    font-size: 15px;
    font-style: italic;
}

.abstract {
    text-align: left;
    margin: 48px auto 40px;
    max-width: 520px;
}

.abstract-label {
    font-family: "Source Sans 3", "Inter", sans-serif;
    font-weight: 600;
    font-size: 11px;
    color: #999999;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 14px;
}

.abstract p {
    font-family: "EB Garamond", Georgia, serif;
    font-size: 17px;
    line-height: 1.72;
    color: #333333;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.abstract p::first-letter {
    font-weight: 500;
}

.title-page-instruction {
    margin-top: 80px;
    font-family: "Source Sans 3", "Inter", sans-serif;
    font-size: 11px;
    color: #999999;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

/* -----------------------------------------------------------
   Chapter opening (drop numeral + header)
   ----------------------------------------------------------- */
.chapter {
    padding: 96px 0 64px;
    position: relative;
}

.chapter-opening {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 520px minmax(0, 1fr);
    column-gap: 48px;
    align-items: start;
    margin-bottom: 56px;
    position: relative;
}

.drop-numeral {
    grid-column: 1;
    justify-self: end;
    align-self: start;
    font-family: "EB Garamond", Georgia, serif;
    font-weight: 500;
    font-size: 120px;
    line-height: 1;
    color: #999999;
    opacity: 0.15;
    user-select: none;
    margin-top: -16px;
    padding-right: 12px;
    letter-spacing: 0;
}

.chapter-header {
    grid-column: 2;
}

.chapter-eyebrow {
    font-family: "Source Sans 3", "Inter", sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: #999999;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    margin-bottom: 16px;
}

.chapter-title {
    font-family: "EB Garamond", Georgia, serif;
    font-weight: 500;
    font-size: 40px;
    line-height: 1.15;
    color: #111111;
    letter-spacing: 0.02em;
    margin-bottom: 20px;
}

.chapter-subtitle {
    font-family: "EB Garamond", Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 19px;
    line-height: 1.55;
    color: #444444;
    max-width: 480px;
}

.chapter-opening .rule,
.chapter-opening .rule.double {
    grid-column: 2;
    margin-top: 28px;
    width: 100%;
}

/* -----------------------------------------------------------
   Rules
   ----------------------------------------------------------- */
.rule {
    height: 0.67px;
    background-color: #999999;
    width: 100%;
}

.rule.double {
    height: 4.67px;
    background: linear-gradient(
        to bottom,
        #999999 0,
        #999999 0.67px,
        transparent 0.67px,
        transparent 4px,
        #999999 4px,
        #999999 4.67px
    );
    background-color: transparent;
}

/* -----------------------------------------------------------
   Chapter body
   ----------------------------------------------------------- */
.chapter-body {
    grid-column: 1 / -1;
    display: contents;
}

/* Each paragraph block uses the same 3-column subgrid */
.paragraph-block {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 520px minmax(0, 1fr);
    column-gap: 48px;
    position: relative;
    padding: 18px 0;
}

.paragraph-block:hover .pilcrow {
    opacity: 0.8;
}

.pilcrow {
    grid-column: 1;
    justify-self: end;
    align-self: start;
    font-family: "EB Garamond", Georgia, serif;
    font-size: 17px;
    color: #999999;
    opacity: 0;
    transition: opacity 150ms ease;
    margin-top: 4px;
    padding-right: 16px;
    user-select: none;
    cursor: pointer;
}

.paragraph-block:not(:hover) .pilcrow {
    transition: opacity 300ms ease;
}

.section-heading {
    grid-column: 2;
    font-family: "EB Garamond", Georgia, serif;
    font-weight: 600;
    font-size: 24px;
    line-height: 1.3;
    color: #222222;
    letter-spacing: 0.01em;
    margin-bottom: 14px;
    margin-top: 8px;
}

.paragraph-block p {
    grid-column: 2;
    font-family: "EB Garamond", Georgia, serif;
    font-size: 18px;
    line-height: 1.78;
    color: #333333;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    margin-bottom: 0;
}

.paragraph-block p + p {
    margin-top: 18px;
    text-indent: 1.5em;
}

/* -----------------------------------------------------------
   Sidenotes
   ----------------------------------------------------------- */
.sidenote-ref {
    font-family: "Source Sans 3", "Inter", sans-serif;
    font-size: 11px;
    color: #B71C1C;
    cursor: pointer;
    padding: 0 1px 0 2px;
    vertical-align: super;
    line-height: 0;
    text-decoration: none;
    transition: color 150ms ease;
    font-weight: 500;
}

.sidenote-ref:hover {
    color: #7a1212;
}

.sidenote {
    grid-column: 3;
    align-self: start;
    font-family: "Source Sans 3", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #666666;
    padding: 4px 0 4px 12px;
    margin-top: 6px;
    border-left: 0.67px solid transparent;
    transition: background-color 200ms ease, border-color 200ms ease;
    max-width: 280px;
    position: relative;
}

.sidenote.flash {
    background-color: #FFF8E1;
    border-left-color: #B71C1C;
}

.sidenote-marker {
    font-weight: 600;
    color: #B71C1C;
    margin-right: 6px;
    font-size: 11px;
    vertical-align: super;
    line-height: 0;
}

.sidenote em {
    font-family: "EB Garamond", Georgia, serif;
    font-style: italic;
    font-size: 14px;
    color: #444444;
}

.sidenote code {
    font-family: "Inconsolata", "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 12px;
    color: #444444;
    background-color: #F5F5F0;
    padding: 1px 4px;
}

.sidenote-figure {
    padding-left: 0;
    border-left: none;
}

.sidenote-figure.flash {
    border-left: none;
    background-color: transparent;
}

/* -----------------------------------------------------------
   Margin figures
   ----------------------------------------------------------- */
.margin-figure {
    max-width: 200px;
    margin: 0;
}

.margin-figure svg {
    display: block;
    width: 100%;
    height: auto;
    background-color: #FFFFFF;
}

.margin-figure figcaption {
    font-family: "Source Sans 3", "Inter", sans-serif;
    font-size: 12px;
    line-height: 1.45;
    color: #666666;
    margin-top: 8px;
    font-style: italic;
}

/* -----------------------------------------------------------
   Full-width figures
   ----------------------------------------------------------- */
.paragraph-block.full-width .full-figure {
    grid-column: 1 / -1;
    margin-top: 32px;
}

.full-figure {
    width: 100%;
    margin: 32px 0;
}

.full-figure svg {
    display: block;
    width: 100%;
    height: auto;
}

.full-figure-rule {
    width: 100%;
    height: 0.67px;
    background-color: #999999;
}

.full-figure-rule.top {
    margin-bottom: 16px;
}

.full-figure-rule.bottom {
    margin-top: 12px;
}

.full-figure figcaption {
    font-family: "Source Sans 3", "Inter", sans-serif;
    font-size: 12px;
    line-height: 1.5;
    color: #666666;
    margin-top: 8px;
    font-style: italic;
    text-align: left;
}

/* -----------------------------------------------------------
   Inline elements
   ----------------------------------------------------------- */
code {
    font-family: "Inconsolata", "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 15px;
    color: #444444;
    background-color: #F5F5F0;
    padding: 1px 5px;
    border-radius: 0;
}

em {
    font-style: italic;
    color: #222222;
}

a {
    color: #B71C1C;
    text-decoration: none;
    border-bottom: 0.67px solid #B71C1C;
    transition: color 150ms ease, border-color 150ms ease;
}

a:hover {
    color: #7a1212;
    border-bottom-color: #7a1212;
}

/* -----------------------------------------------------------
   Tables
   ----------------------------------------------------------- */
.document-table {
    grid-column: 2;
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0 8px;
    font-family: "EB Garamond", Georgia, serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333333;
}

.document-table thead tr {
    border-top: 0.67px solid #333333;
    border-bottom: 0.67px solid #999999;
}

.document-table tbody tr {
    border-bottom: 0.67px solid #E0E0DA;
}

.document-table tbody tr:last-child {
    border-bottom: 0.67px solid #333333;
}

.document-table th {
    font-family: "Source Sans 3", "Inter", sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-align: left;
    padding: 10px 16px 10px 0;
}

.document-table td {
    padding: 10px 16px 10px 0;
    vertical-align: top;
}

.document-table td:first-child,
.document-table td:nth-child(2) {
    font-family: "Inconsolata", monospace;
    font-size: 14px;
    color: #444444;
}

.document-table td:nth-child(3) {
    font-variant-numeric: tabular-nums;
}

.document-table td:nth-child(4) {
    font-style: italic;
    color: #666666;
}

/* -----------------------------------------------------------
   Footnote rule & chapter footer
   ----------------------------------------------------------- */
.footnote-rule {
    grid-column: 2;
    width: 80px;
    height: 0.67px;
    background-color: #999999;
    margin: 56px 0 20px;
}

.chapter-footer {
    grid-column: 2;
    text-align: center;
    margin: 24px 0 8px;
}

.chapter-footer-mark {
    font-family: "EB Garamond", Georgia, serif;
    font-size: 18px;
    color: #999999;
    letter-spacing: 0.4em;
    padding-left: 0.4em;
}

/* -----------------------------------------------------------
   Colophon
   ----------------------------------------------------------- */
.colophon {
    padding: 96px 0 64px;
}

.colophon > .rule {
    grid-column: 2;
    margin-bottom: 48px;
}

.colophon-header {
    grid-column: 2;
    margin-bottom: 32px;
}

.colophon-body {
    grid-column: 2;
}

.colophon-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 24px;
    row-gap: 12px;
    margin-bottom: 32px;
}

.colophon-list dt {
    font-family: "Source Sans 3", "Inter", sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #999999;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    text-align: right;
    padding-top: 4px;
}

.colophon-list dd {
    font-family: "EB Garamond", Georgia, serif;
    font-size: 16px;
    line-height: 1.55;
    color: #333333;
}

.colophon-imprint {
    font-family: "EB Garamond", Georgia, serif;
    font-style: italic;
    font-size: 15px;
    line-height: 1.6;
    color: #666666;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 0.67px solid #E0E0DA;
}

.colophon > .rule.double {
    grid-column: 2;
    margin-top: 48px;
}

/* -----------------------------------------------------------
   Responsive: collapse marginalia on narrow viewports
   ----------------------------------------------------------- */
@media (max-width: 1100px) {
    .chapter,
    .colophon,
    .title-page,
    .chapter-opening,
    .paragraph-block {
        grid-template-columns: 80px minmax(0, 520px) minmax(0, 280px);
        column-gap: 32px;
    }

    .drop-numeral {
        font-size: 96px;
    }
}

@media (max-width: 880px) {
    .document {
        padding: 56px 24px 96px;
    }

    .chapter,
    .colophon,
    .title-page,
    .chapter-opening,
    .paragraph-block {
        grid-template-columns: 100%;
        column-gap: 0;
    }

    .title-page-frame,
    .chapter-header,
    .colophon-header,
    .colophon-body,
    .paragraph-block p,
    .section-heading,
    .document-table,
    .footnote-rule,
    .chapter-footer,
    .chapter-opening .rule,
    .chapter-opening .rule.double,
    .colophon > .rule,
    .colophon > .rule.double {
        grid-column: 1;
    }

    .drop-numeral {
        grid-column: 1;
        justify-self: start;
        font-size: 84px;
        opacity: 0.18;
        margin-bottom: -8px;
    }

    .pilcrow {
        display: none;
    }

    .sidenote {
        grid-column: 1;
        max-width: 100%;
        margin-top: 12px;
        margin-bottom: 12px;
        padding-left: 16px;
        border-left: 0.67px solid #999999;
        font-size: 14px;
    }

    .sidenote-figure {
        border-left: none;
        padding-left: 0;
    }

    .margin-figure {
        max-width: 100%;
    }

    .document-title {
        font-size: 36px;
    }

    .chapter-title {
        font-size: 32px;
    }

    .running-header-doc {
        display: none;
    }

    .running-header-inner {
        padding: 0 16px;
    }
}

/* -----------------------------------------------------------
   Print-style polish
   ----------------------------------------------------------- */
::selection {
    background-color: #FFF8E1;
    color: #111111;
}
