/* ========================================
   BACKGROUND
   ======================================== */

/* Tile the header background image horizontally (original: no-repeat) */
body {
    background-repeat: repeat-x !important;
}


/* ========================================
   LAYOUT & CENTERING
   ======================================== */
#globalwrapper {
    margin: 0 auto !important;
    width: 95% !important; /* % IS FOR DYNAMIC WIDTH */
/*  max-width: 100% !important; */
    display: flex !important;
    position: relative !important;
    left: 0 !important;
}
#pageleft {
    position: static !important;
    flex-shrink: 0;
    width: 12.2em;
    display: flex !important;
    flex-direction: column;
}
#pagelogo {
    position: static !important;
    order: -1;
}
#content {
    flex: 1;
    min-width: 0;
    margin-left: 0 !important;
}

#pageleftcontent {
    position: sticky;
    top: 10px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    padding-top: 0 !important;
}

/*Move Search Bar to Top*/

#header {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

#tabs {
    display: flex !important;
    flex-wrap: wrap-reverse;
    align-items: flex-start;
    justify-content: space-between;
    max-width: 100% !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

#tabs ul {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

#sidesearch {
    background: transparent !important;
    border: none !important;
    margin-left: auto;
    padding-top: 10px !important;
}

#sidesearch form {
    display: flex;
    align-items: center;
    gap: 0;
}

#sidesearch .searchbox {
    width: 280px !important;
    height: 30px !important;
    padding: 4px 8px !important;
    border: 1px solid #aaaaaa !important;
    border-right: none !important;
    border-radius: 2px 0 0 2px !important;
    font-size: 0.9em !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    margin: 0 !important;
}

#sidesearch .searchbutton {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
}

#sidesearch .searchbutton input {
    height: 30px !important;
    padding: 4px 12px !important;
    border: 1px solid #aaaaaa !important;
    border-radius: 0 2px 2px 0 !important;
    background: #f8f9fa !important;
    color: #222 !important;
    font-size: 0.9em !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}

#sidesearch .searchbox:focus {
    outline: none !important;
    border: 1px solid #FFFF99 !important;
    border-right: none !important;
}

/* ========================================
   CONTENT AREA
   ======================================== */

#contentbody {
    background: #191919 !important;
    color: #e0e0e0 !important;
    border: 1px solid #aaaaaa !important;
    width: auto !important;
    max-width: none; /* % IS FOR DYNAMIC WIDTH */
    display: flow-root;
}


/* ========================================
   HEADER & NAVIGATION TABS
   ======================================== */

#header {
    border-bottom: none !important;
    width: auto !important;
    max-width: none; /* % IS FOR DYNAMIC WIDTH */
}

#tabs {
    width: auto !important;
    max-width: none; /* % IS FOR DYNAMIC WIDTH */
}

#tabs ul {
    border-bottom: none !important;
}

/* Remove background texture from tab hover and active states */
#tabs ul li a:link:hover,
#tabs ul li a:visited:hover {
    background-image: none !important;
}

#tabs ul li *#active {
    background: #191919 !important;
}


/* ========================================
   SIDEBAR
   ======================================== */

/* Remove background texture from sidebar blocks */
.pageleftbody {
    background: #191919 !important;
}


/* ========================================
   RIGHT BAR
   ======================================== */

/* Remove background texture */
#rightbar {
    background: #191919 !important;
}


/* ========================================
   FOOTER
   ======================================== */

#footer {
    background: #191919 !important;
    border: 1px solid #aaaaaa !important;
    color: #e0e0e0;
    width: auto !important;
    max-width: none; /* % IS FOR DYNAMIC WIDTH */
}

#footer .navbox a {
    border: none !important;
}

#footer .navbox a:hover {
    border: 1px solid #FFFF99 !important;
}


/* ========================================
   TYPOGRAPHY - Body Font
   ======================================== */

body, #globalwrapper {
    font-family: sans-serif !important;
    font-size: 1em !important;
    line-height: 1.6 !important;
    /* color: #202122 !important; */
    /* DISABLED: This Wikipedia-style dark grey was meant for light backgrounds.
       On this dark theme it would make text nearly invisible outside #contentbody.
       The #e0e0e0 on #contentbody handles the main content area already.
       If you need a body-level text color, use something like #e0e0e0 here. */
}

/* ========================================
   LINKS
   ======================================== */

/* Style for links to pages that do not exist */
#contentbody a.createlink {
    color: #ff4444 !important; /* A bright red that's readable on dark backgrounds */
    text-decoration: italic;    /* Optional: helps distinguish them further */
}

/* Remove the '?' that PmWiki sometimes adds after the link */
#contentbody a.createlink em {
    display: none !important;
}

/* Soften link color from bright yellow to pale yellow */
a {
    color: #FFFF99
}
a:visited { color: #FFFF99 !important; }
a:active { color: #FFFF99 !important; }

/* Remove external link icons from content area */
#contentbody a {
    background-image: none !important;
    background: none !important;
    padding-right: 0 !important;
    margin-right: 0 !important;
}

#contentbody a.external,
#contentbody a.externalfree,
#contentbody a.urllink {
    background: none !important;
    padding: 0 !important;
}

#contentbody a::after {
    content: none !important;
    display: none !important;
}

#contentbody a[href^="https"] {
    background: none !important;
    padding: 0 !important;
}


/* ========================================
   HORIZONTAL RULES
   ======================================== */

/* Fix invalid margin value in original (was "0.2em 0 0.2em 2") */
hr {
    margin: 0.2em 0 0.2em 0 !important;
}


/* ========================================
   TYPOGRAPHY - Headings
   ======================================== */

/* Override heading defaults from the skin */
h1, h2, h3, h4, h5, h6 {
    color: #e0e0e0 !important;
    padding-top: 1em !important;
    padding-bottom: 0.3em !important;
}

h3, h4, h5, h6 {
    font-weight: normal !important;
}

/* Control clear behavior per heading level */
h1 {
    clear: both !important;
}
h2 {
    clear: none !important; /* allow text to wrap around floats */
}

/* Serif heading style for h1/h2 (Wikipedia-inspired) */
h1, h2, .titlepage {
    font-family: 'Linux Libertine', 'Georgia', 'Times', serif !important;
    font-weight: normal !important;
    border-bottom: 1px solid #a2a9b1 !important;
    margin-bottom: 0.25em !important;
    padding-bottom: 0.17em !important;
}


/* ========================================
   TYPOGRAPHY - Paragraphs & Spacing
   ======================================== */

#wikitext h1 + p,
#wikitext h2 + p {
    margin-top: 0.5em;
}

#wikitext p {
    line-height: 1.75em;
    margin-bottom: 1em;
}


/* ========================================
   IMAGES
   ======================================== */

/* Prevent oversized images in the content area */
#contentbody img {
    max-width: 95% !important;
    height: auto !important;
    display: inline-block;
    vertical-align: middle;
}

#contentbody img.img-fluid {
    width: auto;
}


/* ========================================
   TABLES
   ======================================== */
/* Commenting these out--they ruin tables
#wikitext table {
    max-width: 100%;
    table-layout: fixed;
}

#wikitext td {
    overflow: hidden;
} */

/* ========================================
   INFOBOXES
   ======================================== */

.infobox {
    float: right;
    width: 310px;
    background: #333333 !important;
    padding: 10px;
    margin-left: 1.5em;
    display: block;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid #aaaaaa;
}

.infobox img {
    height: auto;
}

#contentbody .infobox img {
    max-width: 100% !important;
}

.infobox-title {
    background-color: #5F9968;
    color: #FFFF99;
    font-weight: bold;
    text-align: center;
    padding: 5px;
    margin: 0px 0 10px 0;
    border: 1px solid #aaaaaa;
    text-shadow:
        -1px -1px 0 #000000,
         1px -1px 0 #000000,
        -1px  1px 0 #000000,
         1px  1px 0 #000000;
}

#wikitext .infobox p.vspace {
    margin-top: 0.5em !important;
    margin-bottom: 0.5em !important;
    line-height: 1.5em !important;
}

@media (max-width: 58.125em) {
    .infobox {
        float: none;
        width: 100%;
        max-width: 100%;
        margin: 0 0 1em 0;
    }
}


/* ========================================
   PICTUREBOXES
   ======================================== */

.picturebox {
    float: right;
    width: 310px;
    background: #333333 !important;
    padding: 10px;
    margin-left: 1.5em;
    display: block;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid #aaaaaa;
}

.picturebox img {
    height: auto;
}

#contentbody .picturebox img {
    max-width: 100% !important;
}

#wikitext .picturebox p {
    margin-bottom: 0;
    margin-top: 5px;
}


/* ========================================
   TABLE OF CONTENTS
   ======================================== */

/* Anchor markers (section symbols) */
span.anchor { font-size: 60%; }
span.anchor a { text-decoration: none; }
span.anchor a:hover { text-decoration: underline; }

/* Top link */
/* The [[top]] anchor is in Site.PageTopMenu so it appears on all pages */
span.toplink { font-size: 60%; font-weight: bold; font-family: sans-serif !important; }
span.toplink a { text-decoration: none; }
span.toplink a:hover { text-decoration: underline; }

/* Float variant */
div.tocfloat {
    border-top: 1px solid #aaaaaa;
    border-bottom: 1px solid #aaaaaa;
    padding-top: 5px;
}

/* Standard TOC box */
div.toc {
    border: 1px solid #aaaaaa;
    background-color: #333333;
}
div.toc p {
    background-color: #5F9968;
    color: #FFFF99;
    font-weight: bold;
    padding: 5px;
    margin: 0px 0 10px 0;
    border: 1px solid #aaaaaa;
    text-shadow:
        -1px -1px 0 #000000,
         1px -1px 0 #000000,
        -1px  1px 0 #000000,
         1px  1px 0 #000000;
}
ol.toc { padding-right: 5px; }

/* Collapsed state */
div.toc-collapsed { border: none !important; background: transparent !important; }
div.toc-collapsed p { border: 1px solid #aaaaaa !important; }
div.tocfloat.toc-collapsed { border: none !important; }
div.tocfloat.toc-collapsed p { border: 1px solid #aaaaaa !important; }

/* Sidebar variants - shared */
div.toc-sidebar-1, div.toc-sidebar-2 { border: none; }
div.toc-sidebar-1 p {
    background-color: transparent;
    color: #e0e0e0;
    font-weight: bold;
    text-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
}

/* Sidebar 1: two-column centered */
div.toc-sidebar-1 ul.toc {
    column-gap: 0;
    margin: 0;
    padding: 0;
    text-align: center;
}

/* Sidebar 2: single-column left-justified */
div.toc-sidebar-2 > ul.toc, div.toc-sidebar-2 > ol.toc {
    margin: 0;
    padding: 0;
}
div.toc-sidebar-2 > b {
    display: block;
    margin-bottom: 0.3em;
}


/* ========================================
   LORETAB
   ======================================== */

.loretab-row {
    margin-bottom: 10px;
    padding: 0px;
}

#contentbody .loretab-row img {
    max-width: 100% !important;
}

/* ========================================
   CODEBLOCK MARKUP [@ .... @]
   ======================================== */

/* Styling for both space-indented and [@ ... @] blocks */
pre, code, .pre {
    background-color: #252525 !important;
    color: #3ef126 !important; 
    border: 1px dashed #444 !important;
    padding: 1em !important;
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 0.95em !important;
    line-height: 1.5 !important;
    overflow-x: auto !important; 
    display: block;
    margin: 1em 0;
    border-radius: 4px;
}

/* Inline code styling (like `this`) */
code {
    display: inline;
    padding: 2px 5px !important;
    margin: 0 2px;
    background-color: #252525 !important;
    border: 1px solid #333 !important;
}


/* ========================================
   ARTICLE TEXTBOX EDITOR
   ======================================== */

textarea.text,
#contentbody textarea {
    height: 800px !important;
    min-height: 600px !important;
    width: 100% !important;
    line-height: 1.5 !important;
    padding: 5px !important;
    box-sizing: border-box !important;
}

textarea.text:focus {
    border: 1px solid #3366cc;
    outline: none;
    box-shadow: inset 0 0 5px rgba(51,102,204,0.1);
}

/* Bump up the summary/author/buttons area (overrides hardcoded 11px in skin) */
#wikitext form,
#wikitext input,
#wikiedit form,
#wikiedit input {
    font-size: 1em !important;
}

/* Bump up the quickref/formatting-rules table at the bottom */
.quickref {
    font-size: 1em !important;
}

/* ========================================
   COPY BUTTON & CODE BOX STYLING
   ======================================== */

/* Container: The PmWiki [@ ... @] block */
pre.escaped {
    position: relative;        /* Keeps the button inside this box */
    padding: 2.5em 1em 1em;    /* Space at top for the button */
    background-color: #f8f9fa;
    border: 1px solid #eaecf0;
    border-left: 4px solid #36c;
    
    /* Force wrapping and hide scrollbar */
    white-space: pre-wrap;       /* CSS3 */
    white-space: -moz-pre-wrap;  /* Firefox */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
    overflow-x: hidden;          /* Removes the horizontal scrollbar */

    line-height: 1.5;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    margin: 1em 0;
}

/* The Copy Button */
.copy-code-button {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 4px 10px;
    background-color: rgb(59, 60, 63);    /* Standard Monobook Blue */
    color: #57eb12;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    font-family: sans-serif;
    z-index: 10;
    opacity: 0.9;
    transition: background-color 0.2s;
}

.copy-code-button:hover {
    background-color: #444;    /* Darker grey on hover */
}

/* Optional: Subtle label for 'copied' state if handled in JS */
.copy-code-button:active {
    background-color: #00af89;
}