/* demosthenes.info — Faithful recreation of original three-column blog layout
   Original by Dudley Storey. Recreated from reference-original-styles.css */

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Base ───────────────────────────────────────────────────────── */
body {
    font-size: 62.5%;
    background: #f9f9f9;
    color: #2A2A21;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Avenir", "Helvetica Neue", Arial, sans-serif;
    margin: 2rem;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #000;
    font-weight: 500;
    text-decoration: none;
}

p a, main ol a, main ul a, td a {
    border-bottom: 1px dashed #999;
    font-weight: 500;
}

p a:hover, main ol a:hover, main ul a:hover {
    border-bottom-color: rgb(231,144,15);
}

code, kbd {
    font-family: 'Inconsolata', 'Fira Code', 'Cascadia Code', Consolas, Courier, monospace;
    font-weight: 100;
    font-style: normal;
}

h1 { clear: both; }

/* ── Outer Container ────────────────────────────────────────────── */
div#outer {
    max-width: 1300px;
    margin: 0 auto;
}

div#wrapper {
    display: flex;
    justify-content: center;
}

/* ── Code / Pre ─────────────────────────────────────────────────── */
pre {
    background: #f5f2f0;
    display: block;
    white-space: normal;
}

pre code, kbd {
    font-size: 1rem;
}

code {
    font-size: 1rem;
    word-break: break-word;
    hyphens: auto;
}

/* Prism.js overrides — match original light theme */
code[class*="language-"],
pre[class*="language-"] {
    background: #f5f2f0;
    color: black;
    text-shadow: 0 1px white;
    direction: ltr;
    word-spacing: normal;
    tab-size: 4;
    border-radius: .3em;
    line-height: 1.8rem;
}

pre[class*="language-"] {
    padding: .1rem .5rem;
    overflow: auto;
}

:not(pre) > code[class*="language-"],
pre[class*="language-"] {
    background: #f5f2f0;
}

:not(pre) > code[class*="language-"] {
    padding: .1em;
    border-radius: .3em;
}

/* Prism token colours — light theme matching original */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: slategray; }
.token.punctuation { color: #999; }
.namespace { opacity: .7; }
.token.property, .token.tag, .token.boolean, .token.number { color: #905; }
.token.selector, .token.attr-name, .token.string { color: #690; }
.token.operator, .token.entity, .token.url,
.language-css .token.string, .style .token.string { color: #a67f59; background: hsla(0,0%,100%,.5); }
.token.atrule, .token.attr-value, .token.keyword { color: #07a; }
.token.regex, .token.important { color: #e90; }
.token.important { font-weight: bold; }
.token.entity { cursor: help; }
.token.function, .token.constant { color: #07a; }
.token.variable { color: #e90; }

div.language-css, div.language-markup, div.language-php, div.language-javascript {
    margin-top: 1rem;
    margin-bottom: 1.2rem;
}

/* ── Sidebars ───────────────────────────────────────────────────── */
div#leftbar, div#rightbar {
    padding: .1rem 1rem;
    width: 15rem;
    display: block;
    flex-shrink: 0;
}

/* ── Main ───────────────────────────────────────────────────────── */
article, section {
    background: #fff;
}

main {
    flex: 1 1 auto;
    display: block;
    background: #f9f9f9;
    max-width: 820px;
}

main article {
    margin-top: 4rem;
    position: relative;
}

/* Category breadcrumb */
main article h1 + span {
    font-size: 1.1rem;
    text-align: right;
    position: absolute;
    right: 1rem;
    top: -2.5rem;
    text-transform: uppercase;
    display: block;
    min-width: 320px;
}

main article h1 + span a {
    font-weight: 600;
    transition: .3s opacity;
    opacity: 1;
}

main article h1 + span a:hover {
    opacity: 0.3;
}

/* ── Article Card ───────────────────────────────────────────────── */
article {
    border: 1px solid #C3C7C7;
    border-radius: 5px;
}

article div.article-controls {
    background: hsl(45, 50%, 98%);
    padding: 2rem 3rem 1rem 3rem;
}

article .maincontent {
    padding: 3rem;
    padding-top: 2rem;
}

/* ── Headings ───────────────────────────────────────────────────── */
main h1, main h2 {
    line-height: 3rem;
    font-weight: 900;
    transition: .7s font-size linear;
}

main h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

main h1 a {
    line-height: 3.5rem;
    transition: .3s color linear;
}

main h1 a:hover {
    color: #2A2A21;
}

main h2 {
    font-size: 2rem;
    line-height: 1.2;
    font-weight: 100;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

main h3 {
    font-size: 1rem;
    line-height: 1.5;
}

h1 a, div[id$=bar] h2, footer h1 {
    text-decoration: none;
    color: rgb(231,144,15);
}

/* ── Sidebar typography ─────────────────────────────────────────── */
div#leftbar h1,
.site-title {
    font-size: 1.5rem;
    line-height: 1;
    margin-bottom: 0;
    margin-top: 0;
}

div[id$=bar] h1, div[id$=bar] h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 2rem;
    line-height: 1.35rem;
}

div[id$=bar] h2 {
    margin-top: 1rem;
    font-weight: 600;
    color: rgb(231,144,15);
}

div[id$=bar] p, div[id$=bar] ul, div[id$=bar] figcaption, p.byline {
    font-size: 1rem;
    margin-top: 0.8rem;
    line-height: 1.8;
    list-style: none;
}

/* ── Left Sidebar ───────────────────────────────────────────────── */
#leftbar a img, #leftbar figure img {
    width: 80px;
    margin-bottom: 1rem;
}

.vcard {
    font-size: 1rem;
    line-height: 1.8;
    margin-top: 0.8rem;
}

.vcard cite {
    font-weight: 400;
}

div#books {
    margin-top: 0;
}

div#books p {
    font-size: .9rem !important;
    line-height: 1.5 !important;
}

div#books img {
    float: left;
    margin-right: 1rem;
}

/* ── Right Sidebar: Topic Nav ───────────────────────────────────── */
div.sitenav {
    margin-top: 0;
}

details {
    font-size: 1rem;
    text-indent: 0;
}

details summary {
    outline: none;
    margin: .5rem 1rem;
    font-weight: 100;
    cursor: pointer;
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::marker {
    display: none;
    content: '';
}

details summary::only-child {
    margin-left: 0;
}

summary ~ a {
    margin-left: 1.5rem;
    line-height: 1.5;
    font-weight: 400;
}

details ~ a, details summary ~ a {
    display: none;
    text-decoration: none;
}

details, details summary,
details[open] summary ~ a,
details[open] a {
    display: block;
}

details summary a {
    color: rgb(231,144,15);
    font-weight: 600;
    font-size: 1.2rem;
}

details[open] summary a {
    color: rgb(231,144,15);
}

details[open] summary ~ a {
    display: block;
    padding: 0.15rem 0;
    color: #2A2A21;
    font-size: 1rem;
    border-bottom: none;
}

details[open] summary ~ a:hover {
    color: rgb(231,144,15);
}

/* Patron section */
#patron {
    margin-top: 1rem;
}

#patron input[type=submit] {
    cursor: pointer;
    background-color: rgb(231,144,15);
    padding: 5px 14px 6px;
    text-shadow: 0 1px 1px rgba(255,255,255,0.75);
    font: 1.2rem -apple-system, BlinkMacSystemFont, "Segoe UI", "Avenir", sans-serif;
    color: white;
    line-height: normal;
    border: 1px solid #ccc;
    border-bottom-color: #bbb;
    border-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.05);
}

/* ── Article Content ────────────────────────────────────────────── */
main p, main code, main ul, main ol, main dl, main kbd {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

main ul, main ol {
    margin-left: 2rem;
}

p.est {
    text-align: right;
    font-size: 1.25rem;
}

p.credit {
    font-size: 1rem;
    font-style: italic;
}

p.byline {
    font-style: italic;
    text-align: right;
}

/* ── Article aside ──────────────────────────────────────────────── */
article aside {
    background: hsl(0, 95%, 96%);
    margin-bottom: 2rem;
    padding: 2rem;
}

article aside h1 {
    font-weight: 100;
    font-size: 2rem;
}

/* ── Figures ────────────────────────────────────────────────────── */
article figure {
    text-align: center;
}

article figcaption {
    font-size: 1rem;
    text-align: center;
    margin: 1rem;
}

img {
    max-width: 100%;
    height: auto;
}

.left {
    float: left;
    clear: left;
    margin-right: 2rem;
    margin-bottom: 1rem;
}

.right {
    float: right;
    clear: right;
    margin-left: 2rem;
    margin-bottom: 1rem;
}

/* ── Tables ─────────────────────────────────────────────────────── */
table {
    font-size: 1rem;
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

table caption {
    font-size: 1rem;
    text-align: center;
    font-weight: 800;
}

/* ── Blockquote ─────────────────────────────────────────────────── */
blockquote {
    margin: 1.5em 0;
    padding: 1em 1.5em;
    border-left: 4px solid rgb(231,144,15);
    background: hsl(45, 50%, 98%);
    font-style: italic;
    color: #5a5a5a;
}

/* ── Definition lists ───────────────────────────────────────────── */
dl { margin: 1.5em 0; }
dt {
    font-weight: 700;
    font-size: 1.15rem;
    margin-top: 1.5em;
    color: rgb(231,144,15);
}
dt:first-child { margin-top: 0; }
dd { padding-left: 1.5em; margin-bottom: 0.75em; }

/* ── Prev/Next navigation ───────────────────────────────────────── */
#prevnext {
    background: #fff;
    overflow: hidden;
    display: flex;
}

#prevnext div {
    width: 50%;
}

#prevnext span {
    padding: 0 .25rem;
}

#prevnext img {
    width: 120px;
}

div[data-set=previous] a, div[data-set=next] a {
    display: table;
    font-size: 1rem;
    line-height: 1.5;
}

div[data-set] a * {
    display: table-cell;
    vertical-align: middle;
}

div[data-set="previous"] { float: left; }
div[data-set="next"] { float: right; }
div[data-set="next"] a.next-one { float: right; }

/* ── CodePen link ───────────────────────────────────────────────── */
a#codepen {
    display: block;
    clear: both;
    background: rgba(0,0,0,0.2);
    font-size: 1.2rem;
    color: #000;
    margin-top: 2rem;
    margin-bottom: 0;
    border-bottom: 0;
    padding: .6rem;
    transition: .6s all;
}

a#codepen img {
    width: 60px;
    height: 60px;
    vertical-align: middle;
    margin-right: 2rem;
}

a#codepen:hover {
    background: rgba(0,0,0,0.8);
    color: #fff;
}

pre + *:not(pre) {
    margin-top: 2rem;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer {
    background: #2A2A21;
    color: #bbb;
    margin-top: 3rem;
    padding: 2rem 1.5rem 1rem;
    font-size: 1rem;
    border-radius: 5px;
}

.footer-inner {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-col {
    flex: 1;
    min-width: 200px;
}

.footer-col h3 {
    font-size: 1rem;
    color: rgb(231,144,15);
    margin-bottom: .5rem;
}

.footer-col p, .footer-col li {
    font-size: .9rem;
    line-height: 1.6;
}

.footer-col ul {
    list-style: none;
}

.footer-col a {
    color: #ccc;
    border-bottom: none;
}

.footer-col a:hover {
    color: rgb(231,144,15);
}

.footer-bottom {
    max-width: 1300px;
    margin: 1.5rem auto 0;
    padding-top: .75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: .8rem;
    opacity: 0.6;
}

.footer-bottom a {
    color: #bbb;
}

/* ── Loading bar ────────────────────────────────────────────────── */
div.loading-bar {
    text-align: center;
    background: #000;
    border-radius: 2px;
    color: #fff;
    font-size: 1.4rem;
    padding: .3rem;
    margin-top: 1rem;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media screen and (max-width: 1300px) {
    div#rightbar {
        display: none;
    }

    div#mid-canvas {
        display: block;
        width: 100%;
    }
}

@media screen and (max-width: 1100px) {
    body { margin: 1rem; }

    main h1 a {
        line-height: 1.2;
    }
}

@media screen and (max-width: 850px) {
    body {
        background: #222;
        margin: 0;
    }

    div#wrapper {
        flex-direction: column;
    }

    div#leftbar {
        padding-bottom: .5rem;
        min-height: 2rem;
        background: #222;
        width: 100%;
    }

    div#leftbar h1 {
        float: left;
        margin: .2rem 0;
        vertical-align: top;
        line-height: 0;
        padding-top: 1rem;
    }

    .vcard, div[id$=bar] h2, div#leftbar div, div#leftbar figure {
        display: none;
    }

    div#leftbar h1 {
        display: inline;
    }

    div#leftbar label {
        color: #fff;
        padding: 0 .5rem;
    }

    main {
        min-width: 100%;
        box-shadow: 0 -8px 8px rgba(0,0,0,0.6);
    }

    main article:only-of-type {
        min-height: 110rem;
    }

    section, article {
        border: none;
        border-radius: 0;
        width: 100%;
    }

    article .maincontent {
        padding: 1rem;
    }

    article div.article-controls {
        padding: 1rem;
    }

    main article h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    /* Mobile nav */
    ul.mobile-nav {
        display: flex;
        list-style: none;
        gap: 0.5rem;
        flex-wrap: wrap;
        padding: 0.5rem;
    }

    ul.mobile-nav a {
        color: #fff;
        font-size: 1.1rem;
        padding: 0.3rem 0.6rem;
        border-radius: 3px;
        background: #333;
    }

    ul.mobile-nav a:hover {
        background: rgb(231,144,15);
    }
}

@media screen and (max-width: 530px) {
    .left, .right {
        float: none;
        display: block;
        margin-right: 0;
        margin-left: 0;
    }

    #prevnext {
        flex-direction: column;
    }

    #prevnext div {
        width: 100%;
    }
}

@media screen and (max-width: 460px) {
    article h1 {
        line-height: 1.2;
    }
}

/* ── Print ──────────────────────────────────────────────────────── */
@media print {
    body { width: 100%; margin: 0; }

    div#wrapper, main, article { display: block; }

    div#leftbar, div#rightbar, .site-footer, #prevnext, div.openinginfo {
        display: none;
    }

    article { border: none; }
    code[class*="language-"] { text-shadow: none; }
}
