/* cocode.css — lightweight org-publish theme
   No jQuery, no Bootstrap, no external fonts.
   Works with htmlize.css for syntax highlighting. */

/* ── Reset & base ────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    font-size: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans",
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #2e3338;
    background: #f7f8fa;
    margin: 0;
    min-height: 100%;
}

/* ── Typography ──────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
    font-family: "Georgia", "Cambria", "Times New Roman", serif;
    font-weight: 700;
    color: #1a1a2e;
    margin-top: 1.8em;
    margin-bottom: 0.6em;
    line-height: 1.3;
}

h1 { font-size: 1.9em; }
h2 { font-size: 1.55em; border-bottom: 2px solid #e0e4e8; padding-bottom: 0.35em; }
h3 { font-size: 1.3em; }
h4 { font-size: 1.15em; color: #2b6cb0; }
h5 { font-size: 1.05em; color: #2b6cb0; }
h6 { font-size: 1em; color: #2b6cb0; }

h1.title {
    margin-top: 0;
    padding-top: 0.5em;
    font-size: 2.1em;
    border-bottom: 3px solid #2b6cb0;
    padding-bottom: 0.3em;
    color: #1a1a2e;
}

.subtitle {
    font-size: 1.1em;
    color: #555;
    margin-top: -0.5em;
    margin-bottom: 1.5em;
}

p {
    margin: 0 0 1em 0;
}

b, strong {
    font-weight: 700;
}

blockquote {
    background: #f0f4f8;
    border-left: 4px solid #2b6cb0;
    margin: 1em 0;
    padding: 0.8em 1.2em;
    font-style: italic;
    color: #444;
    border-radius: 0 4px 4px 0;
}

/* ── Links ───────────────────────────────────────────── */

a {
    color: #2b6cb0;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}

a:hover {
    border-bottom-color: #2b6cb0;
}

a:visited {
    color: #5a4fb0;
}

/* ── Lists ───────────────────────────────────────────── */

ul, ol, dl {
    line-height: 1.6;
    margin: 0 0 1em 0;
    padding-left: 1.5em;
}

li {
    margin-bottom: 0.25em;
}

dt {
    font-weight: 700;
    margin-top: 0.5em;
}

dd {
    margin-left: 1.5em;
    margin-bottom: 0.5em;
}

/* ── Layout: sidebar TOC + content ───────────────────── */

#table-of-contents {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    padding: 1.5em 1em 2em 1.5em;
    background: #1a1a2e;
    color: #c8cdd3;
    overflow-x: hidden;
    overflow-y: auto;
    font-size: 0.82em;
    z-index: 100;
}

#table-of-contents h2 {
    color: #e2e8f0;
    font-size: 1.1em;
    border-bottom: 1px solid #2d3748;
    padding-bottom: 0.4em;
    margin-top: 0;
}

#table-of-contents a {
    color: #a0aec0;
    border-bottom: none;
    display: block;
    padding: 0.15em 0;
    transition: color 0.15s;
}

#table-of-contents a:hover {
    color: #fff;
}

#table-of-contents a:visited {
    color: #a0aec0;
}

#table-of-contents ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

#table-of-contents ul ul {
    padding-left: 1em;
}

#table-of-contents li {
    margin-bottom: 0.1em;
    line-height: 1.5;
}

div#content {
    margin-left: 280px;
    max-width: 900px;
    padding: 2em 3em;
    background: #fff;
    min-height: 100vh;
}

div#postamble {
    margin-left: 280px;
    max-width: 900px;
    padding: 1em 3em 2em;
    font-size: 0.85em;
    color: #888;
    border-top: 1px solid #e0e4e8;
}

/* ── Code blocks ─────────────────────────────────────── */

code {
    font-family: "Inconsolata", "Fira Code", "Source Code Pro",
                 "DejaVu Sans Mono", "Consolas", monospace;
    font-size: 0.92em;
}

/* Inline code */
p > code, li > code, td > code, dd > code {
    background: #edf2f7;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: #c7254e;
}

pre {
    font-family: "Inconsolata", "Fira Code", "Source Code Pro",
                 "DejaVu Sans Mono", "Consolas", monospace;
    font-size: 0.9em;
    line-height: 1.5;
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin: 1em 0;
}

/* Source code blocks */
pre.src {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 1em 1.2em;
    position: relative;
}

/* Language label */
pre.src:before {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.2em 0.6em;
    font-size: 0.75em;
    background: #313244;
    color: #a6adc8;
    border-bottom-left-radius: 6px;
    border: 0;
}

pre.src-bash:before,
pre.src-sh:before    { content: "Shell"; }
pre.src-python:before { content: "Python"; }
pre.src-emacs-lisp:before { content: "Elisp"; }
pre.src-c:before     { content: "C"; }
pre.src-c\\+\\+:before { content: "C++"; }
pre.src-javascript:before { content: "JS"; }
pre.src-rust:before  { content: "Rust"; }
pre.src-elm:before   { content: "Elm"; }
pre.src-org:before   { content: "Org"; }
pre.src-css:before   { content: "CSS"; }
pre.src-html:before  { content: "HTML"; }
pre.src-json:before  { content: "JSON"; }
pre.src-yaml:before  { content: "YAML"; }
pre.src-sql:before   { content: "SQL"; }
pre.src-conf:before  { content: "Config"; }

/* Example / results blocks */
pre.example {
    background: #fefce8;
    color: #555;
    padding: 0.8em 1em;
    border-left: 3px solid #eab308;
}

pre.example:before {
    content: "OUTPUT";
    display: block;
    font-size: 0.7em;
    font-weight: 700;
    color: #a16207;
    letter-spacing: 0.05em;
    margin-bottom: 0.5em;
    border-bottom: 1px dotted #d4c07a;
    padding-bottom: 0.3em;
}

/* ── Tables ──────────────────────────────────────────── */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

table, th, td {
    border: 1px solid #d1d5db;
}

th {
    background: #2b6cb0;
    color: #fff;
    padding: 0.6em 0.8em;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 0.5em 0.8em;
    text-align: left;
}

tbody tr:nth-child(even) {
    background: #f7f8fa;
}

tbody tr:hover {
    background: #edf2f7;
}

/* ── Tags, TODOs ─────────────────────────────────────── */

.tag {
    float: right;
    font-size: 0.75em;
    font-weight: normal;
    margin-top: 0.5em;
}

.tag span {
    background: #718096;
    color: #fff;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    margin-left: 0.3em;
}

.todo, .done {
    font-weight: 600;
    padding: 0.1em 0.4em;
    border-radius: 3px;
    font-size: 0.85em;
}

.todo {
    background: #e53e3e;
    color: #fff;
}

.done {
    background: #38a169;
    color: #fff;
}

/* ── Images ──────────────────────────────────────────── */

img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

div.figure {
    margin: 1.5em 0;
    font-size: 0.85em;
    color: #666;
}

div.figure p {
    margin: 0.3em 0;
}

/* ── Navigation links (home/up) ──────────────────────── */

#org-div-home-and-up {
    margin-left: 280px;
    max-width: 900px;
    font-size: 0.85em;
    margin-bottom: 0;
    padding: 0.8em 3em;
    border-bottom: 1px solid #e0e4e8;
}

#org-div-home-and-up a {
    margin-right: 1.5em;
    font-weight: 600;
}

/* ── Notices (from style.css patterns) ───────────────── */

div.notice {
    position: relative;
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid;
    border-radius: 0 4px 4px 0;
}

div.notice:before {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.2em 0.5em;
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom-left-radius: 4px;
}

.notice-warning { background: #fff5f5; color: #742a2a; border-color: #e53e3e; }
.notice-example { background: #ebf8ff; color: #2a4365; border-color: #3182ce; }
.notice-info    { background: #f0fff4; color: #22543d; border-color: #38a169; }

div.notice-warning:before { content: "WARNING"; background: #e53e3e; color: #fff; }
div.notice-example:before { content: "EXAMPLE"; background: #3182ce; color: #fff; }
div.notice-info:before    { content: "INFO"; background: #38a169; color: #fff; }

div.NOTE {
    position: relative;
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid #38a169;
    background: #f0fff4;
    color: #22543d;
    border-radius: 0 4px 4px 0;
}

div.NOTE:before {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.2em 0.5em;
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom-left-radius: 4px;
    content: "NOTE";
    background: #38a169;
    color: #fff;
}

/* ── Responsive: collapse sidebar on narrow screens ──── */

@media screen and (max-width: 900px) {
    #table-of-contents {
        position: static;
        width: 100%;
        height: auto;
        max-height: 40vh;
        padding: 1em;
        font-size: 0.85em;
        border-bottom: 2px solid #2d3748;
    }

    div#content {
        margin-left: 0;
        max-width: 100%;
        padding: 1.5em;
    }

    div#postamble {
        margin-left: 0;
        max-width: 100%;
        padding: 1em 1.5em;
    }

    #org-div-home-and-up {
        margin-left: 0;
        padding: 0.5em 1.5em;
    }
}

/* ── Print ───────────────────────────────────────────── */

@media print {
    body {
        color: #000;
        background: #fff;
        font-size: 12pt;
    }

    @page {
        margin: 25mm;
    }

    #table-of-contents {
        display: none;
    }

    div#content {
        margin-left: 0;
        max-width: 100%;
        padding: 0;
    }

    h2, h3 {
        page-break-before: always;
        margin-top: 0;
    }

    pre, table {
        page-break-inside: avoid;
    }

    a {
        color: #000;
    }

    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}
