/* =========================================
   Codex: Journal of Cyphernetics
   Essay page styles
   ========================================= */

/* --- Essay Header --- */

.essay-header {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px dotted #ccc;
}

.essay-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.essay-header-meta {
    flex: 1;
}

.essay-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px !important;
    font-weight: 400;
    line-height: 2;
    letter-spacing: 0.02em;
    margin: 0;
    color: #888;
}

.essay-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #888;
    letter-spacing: 0.02em;
    line-height: 2;
}

.essay-meta span {
    display: inline-block;
    margin-right: 1.5em;
}

.essay-meta span::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 3px;
    background: #ccc;
    border-radius: 50%;
    margin-right: 1.5em;
    vertical-align: middle;
}

.essay-meta span:first-child::before {
    display: none;
}

.essay-meta a {
    color: #888;
}

.essay-meta a:hover {
    color: #7d9bca;
}

/* --- Version Nav --- */

#essay-versions {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.02em;
    margin-top: 0.8rem;
}

.version-dropdown {
    display: inline-block;
    position: relative;
}

.version-toggle {
    cursor: pointer;
    color: #888;
    border-bottom: 1px dotted #bbb;
    list-style: none;
}

.version-toggle::-webkit-details-marker {
    display: none;
}

.version-toggle::after {
    content: ' \25BE';
    font-size: 9px;
}

.version-dropdown[open] .version-toggle {
    color: #333;
}

.version-list {
    position: absolute;
    left: 0;
    top: 100%;
    margin: 0.3rem 0 0 0;
    padding: 0.4rem 0;
    list-style: none;
    padding-left: 0;
    background: #fff;
    border: 1px dotted #ccc;
    z-index: 10;
    min-width: 10rem;
}

.version-list li a {
    display: flex;
    justify-content: space-between;
    gap: 1.5em;
    padding: 0.3rem 0.8rem;
    color: #888;
    text-decoration: none;
    white-space: nowrap;
}

.version-list li a:hover {
    color: #7d9bca;
    background: #f8f8f8;
}

.version-list li a.version-current {
    color: #333;
}

.version-date {
    color: #bbb;
    font-size: 10px;
}

/* --- Table of Contents --- */

#essay-toc {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
}

.toc-dropdown {
    display: inline-block;
}

.toc-toggle {
    cursor: pointer;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 10px;
    list-style: none;
}

.toc-toggle::-webkit-details-marker {
    display: none;
}

.toc-toggle::after {
    content: ' \25BE';
    font-size: 9px;
}

.toc-dropdown[open] .toc-toggle {
    color: #333;
}

#essay-toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0 0 0;
}

#essay-toc li {
    margin-bottom: 0.3rem;
}

#essay-toc a {
    color: #888;
    text-decoration: none;
    border-bottom: 1px dotted #bbb;
}

#essay-toc a:hover {
    color: #7d9bca;
    border-bottom-color: #7d9bca;
}

/* --- Essay Body --- */

.essay-body {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-size: 1.18rem;
    line-height: 1.75;
    color: #1a1a1a;
    margin-bottom: 2rem;
}

.essay-body p {
    text-align: justify;
    margin-bottom: 1.3em;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.essay-body em {
    font-style: italic;
}

.essay-body h2 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dotted #ccc;
    color: #333;
}

.essay-body h3 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #444;
}

.essay-body blockquote {
    margin: 1.8em 0;
    padding-left: 1.5em;
    border-left: 2px dotted #bbb;
    color: #333;
    font-size: 1.1rem;
}

/* --- Code Blocks --- */

.essay-body pre {
    overflow-x: auto;
    max-width: 100%;
    padding: 1em 1.2em;
    margin: 1.5em 0;
    background: #f8f8f8;
    border: 1px dotted #ccc;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #1a1a1a;
}

.essay-body code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85em;
}

.essay-body :not(pre) > code {
    background: #f4f4f4;
    padding: 0.15em 0.35em;
    border-radius: 2px;
}

/* --- Sentence ID Anchors --- */

.sid {
    display: none;
}

.sid-key {
    display: none;
}

/* --- Section Breaks --- */

.section-break {
    margin: 2.5rem 0;
    border-top: 1px dotted #ccc;
}

/* --- Citations (Pandoc citeproc output) --- */

.references {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px dotted #000;
}

.references h2 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    border-top: none;
    border-bottom: none;
    padding-top: 0;
    color: #555;
}

.csl-entry {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-size: 0.95rem;
    line-height: 1.55;
    margin-bottom: 0.7em;
    padding-left: 2em;
    text-indent: -2em;
    color: #333;
}

/* Inline citation links */
.essay-body a[role="doc-biblioref"] {
    color: #1a1a1a;
    text-decoration: none;
    border-bottom: 1px dotted #aaa;
}

.essay-body a[role="doc-biblioref"]:hover {
    color: #7d9bca;
    border-bottom-color: #7d9bca;
}

/* --- Download Link --- */

.essay-download {
    margin-top: 0.5rem;
}

.essay-download a {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #888;
    letter-spacing: 0.04em;
    border-bottom: 1px dotted #aaa;
    text-transform: uppercase;
    margin-right: 1em;
}

.essay-download a:hover {
    color: #7d9bca;
    border-bottom-color: #7d9bca;
}

/* --- Responsive --- */

@media (max-width: 600px) {
    .essay-header-row img {
        display: none;
    }

    .essay-title {
        font-size: 12px;
    }

    .essay-body {
        font-size: 1.05rem;
    }

    .essay-body p {
        text-align: left;
        hyphens: none;
    }

    .csl-entry {
        font-size: 0.9rem;
        padding-left: 1em;
        text-indent: -1em;
    }
}
