/* ==========================================================================
   Master Jemdoc Stylesheet
   (Merged & Cleaned: default, jacob.css, nolines.css, exp.css, & Modern Sticky Layout)
   ========================================================================== */

html {
    scroll-behavior: smooth;
}

/* --- Core Page Layout & Typography --- */
body {
    background: white;
    font: 80% Verdana, sans-serif; /* Preferred font stack from exp.css */
    line-height: 1.3;               /* Tight interline space from jacob.css */
    padding-bottom: 8px;
    margin: 0;
}

p {
    margin-top: 0.0em;
    margin-bottom: 1.5em; /* INCREASED: Adds breathing room after text paragraphs */
    padding: 0;
    line-height: 1.3;
}

b, strong {
    font-weight: normal; 
}

strong {
    font-weight: bold;   
}

p b {
    font-style: italic;
}

em {
    font-style: italic;
}

/* --- Code & Monospace Formatting --- */
pre, tt {
    font-size: 110%; /* Preferred size from exp.css */
    font-family: monaco, monospace;
}

tt {
    background: #ffffdd;
    color: #000050;
}

pre {
    color: black;
    padding: 0;
    margin: 0;
}

/* --- Hyperlinks --- */
a, a > tt {
    color: #305080; /* Jacob color choice */
    text-decoration: none;
    border-bottom: 1px solid #bbbbbb;
}

a:hover {
    border-bottom: 1px #305080 dotted; /* Dotted hover rule from jacob.css */
    text-decoration: none;
}

/* --- Headings --- */
h1, h2, h3 {
    color: #203060; /* Deep blue variant from jacob.css */
    margin-top: 1.6em;    /* INCREASED: Pushes down from the preceding section */
    margin-bottom: 0.8em; /* INCREASED: Adds clear separation before the section content starts */
    padding-bottom: 0.2em;
    line-height: 1.0;
    padding-top: 0.5em;
    border-bottom: 1px solid #c0c0c0; /* Kept clean line demarcation */
}

h1 { font-size: 150%; }
h2 { font-size: 115%; padding-top: 0.8em; }
h3 { font-size: 100%; }

h4, h5, h6 {
    border-bottom: 0px solid #c0c0c0;
}

h2 + h3 {
    padding-top: 0.2em;
}

#fwtitle {
    margin: 2px;
}

#fwtitle div#toptitle {
    padding: 1.3em;
}

div#toptitle {
    margin-bottom: 2.0em; /* INCREASED: Added structural gap after top title banner */
    border-bottom: 1px solid #c0c0c0;
}

div#toptitle h1, #layout-content div#toptitle h1 {
    margin-bottom: 0.0em;
    padding-bottom: 0.1em;
    padding-top: 0;
    margin-top: 0.5em;
    border-bottom: none;
}

div#toptitle + h2, div#toptitle + h3 {
    margin-top: -0.7em;
}

div#subtitle {
    margin-top: 0.0em;
    margin-bottom: 0.0em;
    padding-top: 0em;
    padding-bottom: 0.1em;
}

/* ==========================================================================
   Modern Fixed Layout Container Syntax (No-Table Flex Layout)
   ========================================================================== */

/* Overrides structural table behavior to map onto modern flow divs */
#tlayout {
    display: block;
    width: 100%;
}

/* Fixes and narrows the left column sidebar */
#layout-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 120px;       /* Compact narrow width */
    height: 100vh;      /* Full viewport height */
    box-sizing: border-box;
    /* Reduced right padding from 15px to 6px to push text closer to the line */
    padding: 20px 10px 25px 15px; 
    overflow-y: auto;   /* Permits menu scrolling if items expand */
    background-color: #ffffff; 
    border-right: 1px solid #c0c0c0; /* Sidebar divider line */
    line-height: 1.7em;
    text-align: right;  /* Keeps text aligned right toward the line */
    
    /* Flexbox layout to cleanly anchor the top link down */
    display: flex;
    flex-direction: column;
}

/* Offsets the main reading pane to prevent sidebar overlap */
#layout-content {
    /* FIXED: Adjusted to 135px so content stays 15px away from the 120px line */
    margin-left: 135px; 
    width: calc(100% - 135px);
    box-sizing: border-box;
    padding: 25px;
    text-align: left;
}

#layout-content h1:first-child, 
#layout-content h2:first-child, 
#layout-content h3:first-child {
    margin-top: -0.7em;
}

div.menu-category {
    border-bottom: 0px solid gray; 
    margin-top: 0.8em;
    padding-top: 0.2em;
    padding-bottom: 0.1em;
    font-weight: bold;
}

div.menu-item {
    padding-left: 0;
    text-indent: 0;
    padding-bottom: 2px;
}

#layout-menu a:link, #layout-menu a:visited, #layout-menu a:hover {
    color: black;
    text-decoration: none;
    border-bottom: 1px gray solid;
}

#layout-menu a.current:link, #layout-menu a.current:visited {
    color: #203060;
    border-bottom: 1px gray solid;
    font-weight: bold;
}

/* --- Bottom-Anchored Navigation Control --- */
#back-to-top {
    margin-top: auto; 
    padding-top: 30px;
    padding-bottom: 10px;
}

#back-to-top a {
    text-decoration: none;
    font-weight: bold;
    color: #305080;
    display: inline-block;
    font-size: 0.9em;   
    border-bottom: none;
}

#back-to-top a:hover {
    color: #203060;
    border-bottom: 1px dashed #203060;
}

/* --- Lists --- */
ul, ol, dl {
    margin-top: 0.2em;
    padding-top: 0;
    margin-bottom: 1.8em; /* INCREASED: Generates clear space after lists end */
}

dt {
    margin-top: 0.5em;
    margin-bottom: 0;
}

dl {
    margin-left: 20px;
}

dd {
    color: #222222;
}

dd > *:first-child {
    margin-top: 0;
}

ul {
    list-style-position: outside;
    list-style-type: square;
}

p + ul, p + ol {
    margin-top: -0.5em;
}

li ul, li ol {
    margin-top: -0.3em;
}

ol {
    list-style-position: outside;
    list-style-type: decimal;
}

ol ol { list-style-type: lower-alpha; }
ol ol ol { list-style-type: lower-roman; }

li p, dd p {
    margin-bottom: 0.3em;
}

/* --- Content Blocks --- */
p + div.codeblock {
    margin-top: -0.6em;
}

div.codeblock, div.infoblock {
    margin-right: 0%;
    margin-top: 1.2em;
    margin-bottom: 2.0em; /* INCREASED: Generates empty separation space after codeblocks/infoblocks */
}

div.blocktitle {
    font-weight: bold;
    color: #203070; /* Custom block header blue from jacob.css */
    margin-top: 1.2em;
    margin-bottom: 0.1em;
}

div.blockcontent {
    border: 1px solid #c0c0c0;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 6px;
    padding-bottom: 7px;
}

div.blockcontent p + ul, div.blockcontent p + ol {
    margin-top: 0.4em;
}

div.infoblock > div.blockcontent {
    background: #ffffdd; /* Unified warm background style */
}

div.infoblock p { margin-bottom: 0em; }
div.infoblock li p, div.infoblock dd p { margin-bottom: 0.5em; }
div.infoblock p + p { margin-top: 0.8em; }

div.codeblock > div.blockcontent {
    background: #f6f6f6;
}

/* --- Syntax Highlighting --- */
span.pycommand { color: #000070; }
span.statement { color: #008800; }
span.builtin   { color: #000088; }
span.special   { color: #990000; }
span.operator  { color: #880000; }
span.error     { color: #aa0000; }
span.comment, span.comment > *, span.string, span.string > * { color: #606060; }

/* --- Tables & Media Elements --- */
table {
    border: 2px solid black;
    border-collapse: collapse;
    margin-bottom: 2.0em; /* INCREASED: Inserts space directly after a structural table element ends */
}

td {
    padding: 2px;
    padding-left: 0.5em;
    padding-right: 0.5em;
    text-align: center;
    border: 1px solid gray;
}

table + table {
    margin-top: 1em;
}

tr.heading {
    font-weight: bold;
    border-bottom: 2px solid black;
}

img {
    border: none;
}

table.imgtable, table.imgtable td {
    border: none;
    text-align: left;
}

img.eq {
    padding: 0;
    padding-left: 0.1em;
    padding-right: 0.1em;
    margin: 0;
}

img.eqwl {
    padding-left: 2em;
    padding-top: 0.6em;
    padding-bottom: 0.2em;
    margin: 0;
}

/* --- Footer --- */
div#footer {
    border-top: 1px solid #e0e0e0;
    font-size: 80%;
    margin-top: 5.0em; /* INCREASED: Distances footer cleanly from the final content block */
}

div#footer-text {
    float: left;
    padding-bottom: 8px;
}

div#footer a {
    color: #aaaaaa;
    border-bottom: 1px solid #cccccc;
}

/* --- Print Settings --- */
@media print {
    #layout-menu { display: none; }
}