/* =========================================================
   Global layout container
   ========================================================= */
.layout {
    display: flex;
    min-height: 100vh;
    max-width: 1200px;      /* total page width */
    margin: 0 auto;         /* center on large screens */
    background-color: #ffffff;
}

/* =========================================================
   Table of Contents (left sidebar)
   ========================================================= */
nav[role="doc-toc"] {
    flex: 0 0 260px;
    padding: 2rem 1.5rem;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    position: sticky;
    top: 0;

    font-family: "Georgia", "Times New Roman", Times, serif;
    font-size: 16px;
    line-height: 1.6;

    background-color: transparent;
}

nav[role="doc-toc"] > ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

nav[role="doc-toc"] li {
    margin-bottom: 0.5em;
}

nav[role="doc-toc"] a {
    color: #1a0dab;
    text-decoration: none;
}

nav[role="doc-toc"] a:hover {
    text-decoration: underline;
}

/* =========================================================
   Horizontal TOC (index page)
   ========================================================= */
body.toc-horizontal .layout {
    flex-direction: column;
}

body.toc-horizontal nav[role="doc-toc"] {
    position: static;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ddd;
    padding: 1rem 2rem;
    background-color: #ffffff;
}

body.toc-horizontal nav[role="doc-toc"] > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

body.toc-horizontal nav[role="doc-toc"] li {
    margin: 0;
}

/* =========================================================
   Main content area
   ========================================================= */
main {
    flex: 1;
    padding: 2rem 3rem;

    max-width: 820px;          /* ← reading-width constraint */
    margin: 0 auto;            /* center content column */

    font-family: "Georgia", "Times New Roman", Times, serif;
    font-size: 18px;
    line-height: 1.6;
    color: #222;
}

/* =========================================================
   Headings
   ========================================================= */
h1, h2, h3, h4, h5, h6 {
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
    font-weight: 600;
    margin: 1.5em 0 0.5em;
    line-height: 1.3;
    color: #111;
}

/* =========================================================
   Text elements
   ========================================================= */
p, li {
    margin-bottom: 1em;
}

/* =========================================================
   Code
   ========================================================= */
code, pre {
    font-family: "Courier New", Courier, monospace;
    background-color: #f4f4f4;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.95em;
}

/* =========================================================
   MathJax
   ========================================================= */
mjx-container {
    font-size: 1em;
    line-height: 1.5;
}

/* display math */
mjx-container[display="true"] {
    display: block;
    margin: 1em 0;
    text-align: left;
}

/* inline math */
mjx-container:not([display="true"]) {
    display: inline;
}

/* =========================================================
   Figures & media
   ========================================================= */
figure {
    margin: 1.5em 0;
    text-align: center;
}

figcaption {
    font-size: 0.9em;
    color: #555;
}

svg,
canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5em auto;
}

svg text {
    font-family: "STIX Two Text", "Latin Modern Roman", "Times New Roman", serif;
    font-size: 0.95em;
}

svg * {
    vector-effect: non-scaling-stroke;
}

/* =========================================================
   Links & misc
   ========================================================= */
a {
    color: #1a0dab;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

blockquote {
    border-left: 4px solid #ccc;
    margin: 1.5em 0;
    padding-left: 1em;
    color: #555;
    font-style: italic;
}

hr {
    border: 0;
    height: 1px;
    background: #ccc;
    margin: 2em 0;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
    .layout {
        flex-direction: column;
    }

    nav[role="doc-toc"] {
        position: static;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
        padding: 1rem;
    }

    main {
        max-width: 100%;
        padding: 1.5rem;
    }
}


